This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 74373
Collapse All | Expand All

(-)arch.xml (-4 / +66 lines)
Lines 1054-1068 Link Here
1054
            <hint>
1054
            <hint>
1055
            As this is some kind of intermodule dependency, it is a kind of API.
1055
            As this is some kind of intermodule dependency, it is a kind of API.
1056
            Please describe it and classify according to 
1056
            Please describe it and classify according to 
1057
            <a href="http://openide.netbeans.org/tutorial/api-design.html#categories">
1057
                <a href="http://openide.netbeans.org/tutorial/api-design.html#categories">
1058
            common stability categories</a>.
1058
            common stability categories</a>.
1059
            </hint>
1059
            </hint>
1060
        </question>
1060
        </question>
1061
-->
1061
-->
1062
 <answer id="resources-read">
1062
 <answer id="resources-read">
1063
  <p>
1063
    <api group="layer" name="J2SEProjectCustomizer" type="export" category="official">
1064
   No.
1064
     <p>
1065
  </p>
1065
       "J2SEProject/Customizer" folder's content is used to construct the project's customizer.
1066
       It's content is expected to be <code>ProjectCustomizer.CompositeCategoryProvider</code> instances.
1067
       The lookup passed to the panels contains an instance of <code>Project</code> and <code>org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties</code>
1068
       Please note that the latter is not part of any public APIs and you need implementation dependency to make use of it.
1069
     </p>
1070
    </api>
1071
1066
 </answer>
1072
 </answer>
1067
1073
1068
1074
Lines 1097-1102 Link Here
1097
 <answer id="security-policy">
1103
 <answer id="security-policy">
1098
  <p>
1104
  <p>
1099
   No.
1105
   No.
1106
  </p>
1107
 </answer>
1108
1109
1110
1111
1112
<!--
1113
        <question id="arch-where" when="impl">
1114
            Where one can find sources for your module?
1115
            <hint>
1116
                Please provide link to the CVS web client at
1117
                http://www.netbeans.org/download/source_browse.html
1118
                or just use tag defaultanswer generate='here'
1119
            </hint>
1120
        </question>
1121
-->
1122
 <answer id="arch-where">
1123
  <defaultanswer generate='here' />
1124
 </answer>
1125
1126
1127
1128
<!--
1129
        <question id="compat-deprecation" when="init">
1130
            How the introduction of your project influences functionality
1131
            provided by previous version of the product?
1132
            <hint>
1133
            If you are planning to deprecate/remove/change any existing APIs,
1134
            list them here accompanied with the reason explaining why you
1135
            are doing so.
1136
            </hint>
1137
        </question>
1138
-->
1139
 <answer id="compat-deprecation">
1140
  <p>
1141
   XXX no answer for compat-deprecation
1142
  </p>
1143
 </answer>
1144
1145
1146
1147
<!--
1148
        <question id="exec-ant-tasks" when="impl">
1149
            Do you define or register any ant tasks that other can use?
1150
            
1151
            <hint>
1152
            If you provide an ant task that users can use, you need to be very
1153
            careful about its syntax and behaviour, as it most likely forms an
1154
	          API for end users and as there is a lot of end users, their reaction
1155
            when such API gets broken can be pretty strong.
1156
            </hint>
1157
        </question>
1158
-->
1159
 <answer id="exec-ant-tasks">
1160
  <p>
1161
   XXX no answer for exec-ant-tasks
1100
  </p>
1162
  </p>
1101
 </answer>
1163
 </answer>
1102
1164
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties (-7 / +7 lines)
Lines 13-33 Link Here
13
LBL_Customizer_Title=Project Properties - {0}
13
LBL_Customizer_Title=Project Properties - {0}
14
14
15
# Configuration node labels
15
# Configuration node labels
16
LBL_Config_BuildCategory=Build
16
J2SEProject/Customizer/BuildCategory=Build
17
LBL_Config_RunCategory=Run X
17
#LBL_Config_RunCategory=Run X
18
LBL_Config_ProjectDependencies=Required Projects X
18
#LBL_Config_ProjectDependencies=Required Projects X
19
LBL_Config_Libraries=Libraries
19
LBL_Config_Libraries=Libraries
20
LBL_Config_Sources=Sources
20
LBL_Config_Sources=Sources
21
LBL_Config_Build=Compiling
21
LBL_Config_Build=Compiling
22
LBL_Config_BuildTests=Compiling Tests X
22
#LBL_Config_BuildTests=Compiling Tests X
23
LBL_Config_Jar=Packaging
23
LBL_Config_Jar=Packaging
24
LBL_Config_Javadoc=Documenting
24
LBL_Config_Javadoc=Documenting
25
LBL_Config_Run=Run
25
LBL_Config_Run=Run
26
LBL_Config_Test=Running Tests X
26
#LBL_Config_Test=Running Tests X
27
LBL_Config_Debug=Running in Debugger X
27
#LBL_Config_Debug=Running in Debugger X
28
28
29
LBL_Config_WebServiceClients=Web Service Clients
29
LBL_Config_WebServiceClients=Web Service Clients
30
LBL_Config_WebServices=Web Services
30
J2SEProject/Customizer/WebServiceCategory=Web Services
31
31
32
# Panels
32
# Panels
33
33
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerLibraries.java (-3 / +6 lines)
Lines 36-42 Link Here
36
 *
36
 *
37
 * @author  phrebejk
37
 * @author  phrebejk
38
 */
38
 */
39
public class CustomizerLibraries extends JPanel implements HelpCtx.Provider, ListDataListener, CustomizerProviderImpl.SubCategoryProvider {
39
public class CustomizerLibraries extends JPanel implements HelpCtx.Provider, ListDataListener {
40
    
40
    
41
    public static final String COMPILE = "COMPILE";  //NOI18N
41
    public static final String COMPILE = "COMPILE";  //NOI18N
42
    public static final String RUN = "RUN";          //NOI18N
42
    public static final String RUN = "RUN";          //NOI18N
Lines 45-51 Link Here
45
    
45
    
46
    private final J2SEProjectProperties uiProperties;    
46
    private final J2SEProjectProperties uiProperties;    
47
    
47
    
48
    public CustomizerLibraries( J2SEProjectProperties uiProperties ) {
48
    public CustomizerLibraries( J2SEProjectProperties uiProperties, CustomizerProviderImpl.SubCategoryProvider subcat ) {
49
        this.uiProperties = uiProperties;        
49
        this.uiProperties = uiProperties;        
50
        initComponents();        
50
        initComponents();        
51
        
51
        
Lines 118-123 Link Here
118
            } 
118
            } 
119
        });
119
        });
120
        testBroken();
120
        testBroken();
121
        if (J2SECompositePanelProvider.LIBRARIES.equals(subcat.getCategory())) {
122
            showSubCategory(subcat.getSubcategory());
123
        }
121
        
124
        
122
        uiProperties.JAVAC_CLASSPATH_MODEL.addListDataListener( this );
125
        uiProperties.JAVAC_CLASSPATH_MODEL.addListDataListener( this );
123
        uiProperties.JAVAC_TEST_CLASSPATH_MODEL.addListDataListener( this );
126
        uiProperties.JAVAC_TEST_CLASSPATH_MODEL.addListDataListener( this );
Lines 182-188 Link Here
182
    }
185
    }
183
    
186
    
184
    
187
    
185
    public void showSubCategory (String name) {
188
    private void showSubCategory (String name) {
186
        if (name.equals(COMPILE)) {
189
        if (name.equals(COMPILE)) {
187
            jTabbedPane1.setSelectedIndex (0);
190
            jTabbedPane1.setSelectedIndex (0);
188
        }        
191
        }        
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerProviderImpl.java (-165 / +31 lines)
Lines 38-44 Link Here
38
import org.netbeans.spi.project.ui.CustomizerProvider;
38
import org.netbeans.spi.project.ui.CustomizerProvider;
39
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
39
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
40
import org.openide.util.HelpCtx;
40
import org.openide.util.HelpCtx;
41
import org.openide.util.Lookup;
41
import org.openide.util.NbBundle;
42
import org.openide.util.NbBundle;
43
import org.openide.util.lookup.Lookups;
42
44
43
45
44
/** Customization of J2SE project
46
/** Customization of J2SE project
Lines 63-68 Link Here
63
    // Option command names
65
    // Option command names
64
    private static final String COMMAND_OK = "OK";          // NOI18N
66
    private static final String COMMAND_OK = "OK";          // NOI18N
65
    private static final String COMMAND_CANCEL = "CANCEL";  // NOI18N
67
    private static final String COMMAND_CANCEL = "CANCEL";  // NOI18N
68
69
    public static final String CUSTOMIZER_FOLDER_PATH = "J2SEProject/Customizer"; //NO18N
66
    
70
    
67
    private static Map /*<Project,Dialog>*/project2Dialog = new HashMap(); 
71
    private static Map /*<Project,Dialog>*/project2Dialog = new HashMap(); 
68
    
72
    
Lines 87-267 Link Here
87
        
91
        
88
        Dialog dialog = (Dialog)project2Dialog.get (project);
92
        Dialog dialog = (Dialog)project2Dialog.get (project);
89
        if ( dialog != null ) {            
93
        if ( dialog != null ) {            
90
            dialog.show ();
94
            dialog.setVisible(true);
91
            return;
95
            return;
92
        }
96
        }
93
        else {
97
        else {
94
            J2SEProjectProperties uiProperties = new J2SEProjectProperties( (J2SEProject)project, updateHelper, evaluator, refHelper, genFileHelper );        
98
            J2SEProjectProperties uiProperties = new J2SEProjectProperties( (J2SEProject)project, updateHelper, evaluator, refHelper, genFileHelper );
95
            init( uiProperties );
99
            Lookup context = Lookups.fixed(new Object[] {
100
                project,
101
                uiProperties,
102
                new SubCategoryProvider(preselectedCategory, preselectedSubCategory)
103
            });
96
104
97
            OptionListener listener = new OptionListener( project, uiProperties );
105
            OptionListener listener = new OptionListener( project, uiProperties );
98
            // HelpCtx helpCtx = new HelpCtx( "org.netbeans.modules.java.j2seproject.ui.customizer.J2SECustomizer" );
106
            dialog = ProjectCustomizer.createCustomizerDialog( CUSTOMIZER_FOLDER_PATH, context, preselectedCategory, listener, null );
99
            if (preselectedCategory != null && preselectedSubCategory != null) {
100
                for (int i=0; i<categories.length; i++ ) {
101
                    if (preselectedCategory.equals(categories[i].getName())) {
102
                        JComponent component = panelProvider.create (categories[i]);
103
                        if (component instanceof SubCategoryProvider) {
104
                            ((SubCategoryProvider)component).showSubCategory(preselectedSubCategory);
105
                        }
106
                        break;
107
                    }
108
                }
109
            }
110
            dialog = ProjectCustomizer.createCustomizerDialog( categories, panelProvider, preselectedCategory, listener, null );
111
            dialog.addWindowListener( listener );
107
            dialog.addWindowListener( listener );
112
            dialog.setTitle( MessageFormat.format(                 
108
            dialog.setTitle( MessageFormat.format(                 
113
                    NbBundle.getMessage( CustomizerProviderImpl.class, "LBL_Customizer_Title" ), // NOI18N 
109
                    NbBundle.getMessage( CustomizerProviderImpl.class, "LBL_Customizer_Title" ), // NOI18N 
114
                    new Object[] { ProjectUtils.getInformation(project).getDisplayName() } ) );
110
                    new Object[] { ProjectUtils.getInformation(project).getDisplayName() } ) );
115
111
116
            project2Dialog.put(project, dialog);
112
            project2Dialog.put(project, dialog);
117
            dialog.show();
113
            dialog.setVisible(true);
118
        }
114
        }
119
    }    
115
    }    
120
    
116
    
121
    // Names of categories
122
    private static final String BUILD_CATEGORY = "BuildCategory";
123
    private static final String RUN_CATEGORY = "RunCategory";
124
    
125
    private static final String GENERAL = "General";
126
    private static final String SOURCES = "Sources";
127
    private static final String LIBRARIES = "Libraries";
128
    
129
    private static final String BUILD = "Build";
130
    private static final String BUILD_TESTS = "BuildTests";
131
    private static final String JAR = "Jar";
132
    private static final String JAVADOC = "Javadoc";
133
    private static final String RUN = "Run";    
134
    private static final String RUN_TESTS = "RunTests";
135
    
136
    private static final String WEBSERVICECLIENTS = "WebServiceClients";
137
    private static final String WEBSERVICE_CATEGORY = "WebServiceCategory";
138
    
139
    private void init( J2SEProjectProperties uiProperties ) {
140
        
141
        ResourceBundle bundle = NbBundle.getBundle( CustomizerProviderImpl.class );
142
    
143
        /*
144
        ProjectCustomizer.Category general = ProjectCustomizer.Category.create( 
145
                BUILD, 
146
                bundle.getString( "LBL_Config_Build" ), 
147
                null, 
148
                null );        
149
        */
150
        
151
        
152
        ProjectCustomizer.Category sources = ProjectCustomizer.Category.create(
153
                SOURCES,
154
                bundle.getString ("LBL_Config_Sources"),
155
                null,
156
                null);
157
        
158
        ProjectCustomizer.Category libraries = ProjectCustomizer.Category.create (
159
                LIBRARIES,
160
                bundle.getString( "LBL_Config_Libraries" ), // NOI18N
161
                null,
162
                null );
163
        
164
        ProjectCustomizer.Category build = ProjectCustomizer.Category.create(
165
                BUILD, 
166
                bundle.getString( "LBL_Config_Build" ), // NOI18N
167
                null,
168
                null);
169
        ProjectCustomizer.Category jar = ProjectCustomizer.Category.create(
170
                JAR,
171
                bundle.getString( "LBL_Config_Jar" ), // NOI18N
172
                null,
173
                null );
174
        ProjectCustomizer.Category javadoc = ProjectCustomizer.Category.create(
175
                JAVADOC,
176
                bundle.getString( "LBL_Config_Javadoc" ), // NOI18N
177
                null,
178
                null );
179
        
180
        ProjectCustomizer.Category run = ProjectCustomizer.Category.create(
181
                RUN,
182
                bundle.getString( "LBL_Config_Run" ), // NOI18N
183
                null,
184
                null );    
185
        ProjectCustomizer.Category runTests = ProjectCustomizer.Category.create(
186
                RUN_TESTS,
187
                bundle.getString( "LBL_Config_Test" ), // NOI18N
188
                null,
189
                null);
190
191
        ProjectCustomizer.Category buildCategory = ProjectCustomizer.Category.create(
192
                BUILD_CATEGORY,
193
                bundle.getString( "LBL_Config_BuildCategory" ), // NOI18N
194
                null,
195
                new ProjectCustomizer.Category[] { build, jar, javadoc }  );
196
                
197
        ProjectCustomizer.Category clients = ProjectCustomizer.Category.create(
198
                WEBSERVICECLIENTS,
199
                bundle.getString( "LBL_Config_WebServiceClients" ), // NOI18N
200
                null,
201
                null);
202
                
203
        ProjectCustomizer.Category webServices = ProjectCustomizer.Category.create(
204
                WEBSERVICE_CATEGORY,
205
                bundle.getString( "LBL_Config_WebServices" ), // NOI18N
206
                null,
207
                new ProjectCustomizer.Category[] { clients } );
208
                
209
        categories = new ProjectCustomizer.Category[] { 
210
                sources,
211
                libraries,        
212
                buildCategory,
213
                run,  
214
                webServices
215
        };
216
                
217
        List serviceClientsSettings = null;
218
        WebServicesClientSupport clientSupport = WebServicesClientSupport.getWebServicesClientSupport(project.getProjectDirectory());
219
        if (clientSupport != null) {
220
            serviceClientsSettings = clientSupport.getServiceClients();
221
        }
222
                
223
        categories = new ProjectCustomizer.Category[] { 
224
                sources,
225
                libraries,        
226
                buildCategory,
227
                run,  
228
                webServices
229
        };        
230
        
231
        Map panels = new HashMap();
232
        panels.put( sources, new CustomizerSources( uiProperties ) );
233
        panels.put( libraries, new CustomizerLibraries( uiProperties ) );
234
        panels.put( build, new CustomizerCompile( uiProperties ) );
235
        panels.put( jar, new CustomizerJar( uiProperties ) );
236
        panels.put( javadoc, new CustomizerJavadoc( uiProperties ) );
237
        panels.put( run, new CustomizerRun( uiProperties ) ); 
238
        
239
        if(serviceClientsSettings != null && serviceClientsSettings.size() > 0) {
240
            panels.put( clients, new CustomizerWSClientHost( uiProperties, serviceClientsSettings ));
241
        } else {
242
            panels.put( clients, new NoWebServiceClientsPanel());
243
        }
244
        panelProvider = new PanelProvider( panels );
245
        
246
    }
247
    
248
    private static class PanelProvider implements ProjectCustomizer.CategoryComponentProvider {
249
        
250
        private JPanel EMPTY_PANEL = new JPanel();
251
        
252
        private Map /*<Category,JPanel>*/ panels;
253
        
254
        PanelProvider( Map panels ) {
255
            this.panels = panels;            
256
        }
257
        
258
        public JComponent create( ProjectCustomizer.Category category ) {
259
            JComponent panel = (JComponent)panels.get( category );
260
            return panel == null ? EMPTY_PANEL : panel;
261
        }
262
                        
263
    }
264
    
265
    /** Listens to the actions on the Customizer's option buttons */
117
    /** Listens to the actions on the Customizer's option buttons */
266
    private class OptionListener extends WindowAdapter implements ActionListener {
118
    private class OptionListener extends WindowAdapter implements ActionListener {
267
    
119
    
Lines 282-288 Link Here
282
            // Close & dispose the the dialog
134
            // Close & dispose the the dialog
283
            Dialog dialog = (Dialog)project2Dialog.get( project );
135
            Dialog dialog = (Dialog)project2Dialog.get( project );
284
            if ( dialog != null ) {
136
            if ( dialog != null ) {
285
                dialog.hide();
137
                dialog.setVisible(false);
286
                dialog.dispose();
138
                dialog.dispose();
287
            }
139
            }
288
        }        
140
        }        
Lines 298-311 Link Here
298
            //may not be called
150
            //may not be called
299
            Dialog dialog = (Dialog)project2Dialog.get( project );
151
            Dialog dialog = (Dialog)project2Dialog.get( project );
300
            if ( dialog != null ) {
152
            if ( dialog != null ) {
301
                dialog.hide ();
153
                dialog.setVisible(false);
302
                dialog.dispose();
154
                dialog.dispose();
303
            }
155
            }
304
        }
156
        }
305
    }
157
    }
306
    
158
    
307
    static interface SubCategoryProvider {
159
    static final class SubCategoryProvider {
308
        public void showSubCategory (String name);
160
161
        private String subcategory;
162
163
        private String category;
164
165
        SubCategoryProvider(String category, String subcategory) {
166
            this.category = category;
167
            this.subcategory = subcategory;
168
        }
169
        public String getCategory() {
170
            return category;
171
        }
172
        public String getSubcategory() {
173
            return subcategory;
174
        }
309
    }
175
    }
310
   
176
   
311
                            
177
                            
(-)src/org/netbeans/modules/java/j2seproject/ui/resources/layer.xml (+51 lines)
Lines 65-68 Link Here
65
            <file name="CopyLibs.xml" url="CopyLibs.xml"/>
65
            <file name="CopyLibs.xml" url="CopyLibs.xml"/>
66
        </folder>
66
        </folder>
67
    </folder>
67
    </folder>
68
    <folder name="J2SEProject">
69
        <folder name="Customizer">
70
            <file name="Sources.instance">
71
                <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
72
                <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
73
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createSources"/>
74
            </file>
75
            <attr name="Sources.instance/Libraries.instance" boolvalue="true"/>
76
            <file name="Libraries.instance">
77
                <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
78
                <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
79
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createLibraries"/>
80
            </file>
81
            <attr name="Libraries.instance/BuildCategory" boolvalue="true"/>
82
            <folder name="BuildCategory">
83
                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.Bundle"/>
84
                <file name="Build.instance">
85
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
86
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
87
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createBuild"/>
88
                </file>
89
                <attr name="Build.instance/Jar.instance" boolvalue="true"/>
90
                <file name="Jar.instance">
91
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
92
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
93
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createJar"/>
94
                </file>
95
                <attr name="Jar.instance/Javadoc.instance" boolvalue="true"/>
96
                <file name="Javadoc.instance">
97
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
98
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
99
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createJavadoc"/>
100
                </file>
101
            </folder>
102
            <attr name="BuildCategory/Run.instance" boolvalue="true"/>
103
            <file name="Run.instance">
104
                <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
105
                <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
106
                <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createRun"/>
107
            </file>
108
            <attr name="Run.instance/WebServiceCategory" boolvalue="true"/>
109
            <folder name="WebServiceCategory">
110
                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.Bundle"/>
111
                <file name="Client.instance">
112
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider"/>
113
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.project.ui.support.ProjectCustomizer.CompositeCategoryProvider"/>
114
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seproject.ui.customizer.J2SECompositePanelProvider.createWebServiceClients"/>
115
                </file>
116
            </folder>
117
        </folder>
118
    </folder>
68
</filesystem>
119
</filesystem>

Return to bug 74373