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 64777
Collapse All | Expand All

(-)ant/freeform/src/org/netbeans/modules/ant/freeform/ui/ProjectCustomizerProvider.java (-21 / +9 lines)
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 18-25 Link Here
18
import java.awt.event.ActionListener;
18
import java.awt.event.ActionListener;
19
import java.io.IOException;
19
import java.io.IOException;
20
import java.text.MessageFormat;
20
import java.text.MessageFormat;
21
import java.util.Map;
22
import java.util.WeakHashMap;
23
import javax.swing.JButton;
21
import javax.swing.JButton;
24
import org.netbeans.api.project.Project;
22
import org.netbeans.api.project.Project;
25
import org.netbeans.api.project.ProjectManager;
23
import org.netbeans.api.project.ProjectManager;
Lines 52-58 Link Here
52
    private static final String COMMAND_CANCEL = "CANCEL";  // NOI18N
50
    private static final String COMMAND_CANCEL = "CANCEL";  // NOI18N
53
    
51
    
54
    private DialogDescriptor dialogDescriptor;
52
    private DialogDescriptor dialogDescriptor;
55
    private Map customizerPerProject = new WeakHashMap (); // Is is weak needed here?
53
    private Dialog dialog = null;
56
    
54
    
57
    public ProjectCustomizerProvider(FreeformProject project, AntProjectHelper antProjectHelper, PropertyEvaluator evaluator) {
55
    public ProjectCustomizerProvider(FreeformProject project, AntProjectHelper antProjectHelper, PropertyEvaluator evaluator) {
58
        this.project = project;
56
        this.project = project;
Lines 61-76 Link Here
61
    }
59
    }
62
            
60
            
63
    public void showCustomizer() {
61
    public void showCustomizer() {
64
        
62
	// check if the project is being customized already
65
        if (customizerPerProject.containsKey (project)) {
63
        if (dialog != null && dialog.isShowing()) {
66
            Dialog dlg = (Dialog)customizerPerProject.get (project);
64
	    dialog.show();
67
            
65
	    return;
68
            // check if the project is being customized
69
            if (dlg.isShowing ()) {
70
                // make it showed
71
                dlg.show();
72
                return ;
73
            }
74
        }
66
        }
75
67
76
        // Create options
68
        // Create options
Lines 106-121 Link Here
106
        pc.setDialogDescriptor( dialogDescriptor );        
98
        pc.setDialogDescriptor( dialogDescriptor );        
107
        dialogDescriptor.setClosingOptions( new Object[] { options[ OPTION_OK ], options[ OPTION_CANCEL ] } );
99
        dialogDescriptor.setClosingOptions( new Object[] { options[ OPTION_OK ], options[ OPTION_CANCEL ] } );
108
100
109
        Dialog dialog = DialogDisplayer.getDefault().createDialog( dialogDescriptor );
101
        dialog = DialogDisplayer.getDefault().createDialog( dialogDescriptor );
110
111
        customizerPerProject.put (project, dialog);
112
113
        dialog.show();
102
        dialog.show();
114
        
115
    }    
103
    }    
116
    
104
    
117
118
    
119
    /** Listens to the actions on the Customizer's option buttons */
105
    /** Listens to the actions on the Customizer's option buttons */
120
    private static class OptionListener implements ActionListener {
106
    private static class OptionListener implements ActionListener {
121
    
107
    
Lines 139-144 Link Here
139
                    ErrorManager.getDefault().notify( ex );
125
                    ErrorManager.getDefault().notify( ex );
140
                }
126
                }
141
            }
127
            }
128
	    
129
	    dialog = null;
142
            
130
            
143
        }        
131
        }        
144
        
132
        
(-)java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerProviderImpl.java (-20 / +7 lines)
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();

Return to bug 64777