Lines 7-13
Link Here
|
7 |
* http://www.sun.com/ |
7 |
* http://www.sun.com/ |
8 |
* |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
12 |
*/ |
13 |
|
13 |
|
Lines 37-46
Link Here
|
37 |
import org.netbeans.spi.project.support.ant.ReferenceHelper; |
37 |
import org.netbeans.spi.project.support.ant.ReferenceHelper; |
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; |
|
|
41 |
import org.openide.util.NbBundle; |
40 |
import org.openide.util.NbBundle; |
42 |
|
41 |
|
43 |
|
|
|
44 |
/** Customization of J2SE project |
42 |
/** Customization of J2SE project |
45 |
* |
43 |
* |
46 |
* @author Petr Hrebejk |
44 |
* @author Petr Hrebejk |
Lines 64-70
Link Here
|
64 |
private static final String COMMAND_OK = "OK"; // NOI18N |
62 |
private static final String COMMAND_OK = "OK"; // NOI18N |
65 |
private static final String COMMAND_CANCEL = "CANCEL"; // NOI18N |
63 |
private static final String COMMAND_CANCEL = "CANCEL"; // NOI18N |
66 |
|
64 |
|
67 |
private static Map /*<Project,Dialog>*/project2Dialog = new HashMap(); |
65 |
private Dialog dialog = null; |
68 |
|
66 |
|
69 |
public CustomizerProviderImpl(Project project, UpdateHelper updateHelper, PropertyEvaluator evaluator, ReferenceHelper refHelper, GeneratedFilesHelper genFileHelper) { |
67 |
public CustomizerProviderImpl(Project project, UpdateHelper updateHelper, PropertyEvaluator evaluator, ReferenceHelper refHelper, GeneratedFilesHelper genFileHelper) { |
70 |
this.project = project; |
68 |
this.project = project; |
Lines 84-100
Link Here
|
84 |
} |
82 |
} |
85 |
|
83 |
|
86 |
public void showCustomizer( String preselectedCategory, String preselectedSubCategory ) { |
84 |
public void showCustomizer( String preselectedCategory, String preselectedSubCategory ) { |
87 |
|
85 |
if (dialog == null) { |
88 |
Dialog dialog = (Dialog)project2Dialog.get (project); |
|
|
89 |
if ( dialog != null ) { |
90 |
dialog.show (); |
91 |
return; |
92 |
} |
93 |
else { |
94 |
J2SEProjectProperties uiProperties = new J2SEProjectProperties( (J2SEProject)project, updateHelper, evaluator, refHelper, genFileHelper ); |
86 |
J2SEProjectProperties uiProperties = new J2SEProjectProperties( (J2SEProject)project, updateHelper, evaluator, refHelper, genFileHelper ); |
95 |
init( uiProperties ); |
87 |
init( uiProperties ); |
96 |
|
88 |
|
97 |
OptionListener listener = new OptionListener( project, uiProperties ); |
89 |
OptionListener listener = new OptionListener(uiProperties); |
98 |
// HelpCtx helpCtx = new HelpCtx( "org.netbeans.modules.java.j2seproject.ui.customizer.J2SECustomizer" ); |
90 |
// HelpCtx helpCtx = new HelpCtx( "org.netbeans.modules.java.j2seproject.ui.customizer.J2SECustomizer" ); |
99 |
if (preselectedCategory != null && preselectedSubCategory != null) { |
91 |
if (preselectedCategory != null && preselectedSubCategory != null) { |
100 |
for (int i=0; i<categories.length; i++ ) { |
92 |
for (int i=0; i<categories.length; i++ ) { |
Lines 113-121
Link Here
|
113 |
NbBundle.getMessage( CustomizerProviderImpl.class, "LBL_Customizer_Title" ), // NOI18N |
105 |
NbBundle.getMessage( CustomizerProviderImpl.class, "LBL_Customizer_Title" ), // NOI18N |
114 |
new Object[] { ProjectUtils.getInformation(project).getDisplayName() } ) ); |
106 |
new Object[] { ProjectUtils.getInformation(project).getDisplayName() } ) ); |
115 |
|
107 |
|
116 |
project2Dialog.put(project, dialog); |
|
|
117 |
dialog.show(); |
118 |
} |
108 |
} |
|
|
109 |
dialog.show(); |
119 |
} |
110 |
} |
120 |
|
111 |
|
121 |
// Names of categories |
112 |
// Names of categories |
Lines 265-275
Link Here
|
265 |
/** Listens to the actions on the Customizer's option buttons */ |
256 |
/** Listens to the actions on the Customizer's option buttons */ |
266 |
private class OptionListener extends WindowAdapter implements ActionListener { |
257 |
private class OptionListener extends WindowAdapter implements ActionListener { |
267 |
|
258 |
|
268 |
private Project project; |
|
|
269 |
private J2SEProjectProperties uiProperties; |
259 |
private J2SEProjectProperties uiProperties; |
270 |
|
260 |
|
271 |
OptionListener( Project project, J2SEProjectProperties uiProperties ) { |
261 |
OptionListener(J2SEProjectProperties uiProperties) { |
272 |
this.project = project; |
|
|
273 |
this.uiProperties = uiProperties; |
262 |
this.uiProperties = uiProperties; |
274 |
} |
263 |
} |
275 |
|
264 |
|
Lines 280-286
Link Here
|
280 |
uiProperties.save(); |
269 |
uiProperties.save(); |
281 |
|
270 |
|
282 |
// Close & dispose the the dialog |
271 |
// Close & dispose the the dialog |
283 |
Dialog dialog = (Dialog)project2Dialog.get( project ); |
|
|
284 |
if ( dialog != null ) { |
272 |
if ( dialog != null ) { |
285 |
dialog.hide(); |
273 |
dialog.hide(); |
286 |
dialog.dispose(); |
274 |
dialog.dispose(); |
Lines 290-302
Link Here
|
290 |
// Listening to window events ------------------------------------------ |
278 |
// Listening to window events ------------------------------------------ |
291 |
|
279 |
|
292 |
public void windowClosed( WindowEvent e) { |
280 |
public void windowClosed( WindowEvent e) { |
293 |
project2Dialog.remove( project ); |
281 |
dialog = null; |
294 |
} |
282 |
} |
295 |
|
283 |
|
296 |
public void windowClosing (WindowEvent e) { |
284 |
public void windowClosing (WindowEvent e) { |
297 |
//Dispose the dialog otherwsie the {@link WindowAdapter#windowClosed} |
285 |
//Dispose the dialog otherwsie the {@link WindowAdapter#windowClosed} |
298 |
//may not be called |
286 |
//may not be called |
299 |
Dialog dialog = (Dialog)project2Dialog.get( project ); |
|
|
300 |
if ( dialog != null ) { |
287 |
if ( dialog != null ) { |
301 |
dialog.hide (); |
288 |
dialog.hide (); |
302 |
dialog.dispose(); |
289 |
dialog.dispose(); |