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

(-)apichanges.xml (+18 lines)
Lines 81-86 Link Here
81
    <!-- ACTUAL CHANGES BEGIN HERE: -->
81
    <!-- ACTUAL CHANGES BEGIN HERE: -->
82
82
83
    <changes>
83
    <changes>
84
        <change id="ProjectCustomizer.Category.buttonListener">
85
            <api name="general"/>
86
            <summary>Ability to attach a ok button listener on single customizer category.</summary>
87
            <version major="1" minor="20"/>
88
            <date day="13" month="10" year="2006"/>
89
            <author login="mkleint"/>
90
            <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible">
91
            </compatibility>
92
            <description>
93
                Allow to attach a listener to <code>ProjectCustomizer.Category</code> that will notify the Category
94
                and it's panel that the changes ought to be applied. This is generally useful as a fallback, general
95
                solution for 3rd party plugging into the project customizer in case the given project type doesn't provide
96
                model-driven project updating mechanism.
97
            </description>
98
            <class package="org.netbeans.spi.project.ui.support" name="ProjectCustomizer"/>
99
            <issue number="86405"/>
100
        </change>
101
        
84
        <change id="lookup-provider">
102
        <change id="lookup-provider">
85
            <api name="general"/>
103
            <api name="general"/>
86
            <summary>Added LookupMerger implementations for PrivilegedTemplates and RecommendedTemplates</summary>
104
            <summary>Added LookupMerger implementations for PrivilegedTemplates and RecommendedTemplates</summary>
(-)nbproject/project.properties (-1 / +1 lines)
Lines 17-23 Link Here
17
17
18
javac.compilerargs=-Xlint -Xlint:-serial
18
javac.compilerargs=-Xlint -Xlint:-serial
19
javac.source=1.5
19
javac.source=1.5
20
spec.version.base=1.19.0
20
spec.version.base=1.20.0
21
is.autoload=true
21
is.autoload=true
22
javadoc.arch=${basedir}/arch.xml
22
javadoc.arch=${basedir}/arch.xml
23
javadoc.apichanges=${basedir}/apichanges.xml
23
javadoc.apichanges=${basedir}/apichanges.xml
(-)src/org/netbeans/modules/project/uiapi/CustomizerDialog.java (-5 / +19 lines)
Lines 79-85 Link Here
79
79
80
80
81
        // RegisterListener
81
        // RegisterListener
82
        ActionListener optionsListener = new OptionListener( okOptionListener );
82
        ActionListener optionsListener = new OptionListener( okOptionListener, categories );
83
        options[ OPTION_OK ].addActionListener( optionsListener );
83
        options[ OPTION_OK ].addActionListener( optionsListener );
84
        options[ OPTION_CANCEL ].addActionListener( optionsListener );
84
        options[ OPTION_CANCEL ].addActionListener( optionsListener );
85
85
Lines 148-166 Link Here
148
    private static class OptionListener implements ActionListener {
148
    private static class OptionListener implements ActionListener {
149
149
150
        private ActionListener okOptionListener;
150
        private ActionListener okOptionListener;
151
        private ProjectCustomizer.Category[] categories;
151
152
152
        OptionListener( ActionListener okOptionListener ) {
153
        OptionListener( ActionListener okOptionListener, ProjectCustomizer.Category[] categs) {
153
            this.okOptionListener = okOptionListener;
154
            this.okOptionListener = okOptionListener;
155
            categories = categs;
154
        }
156
        }
155
157
        
156
        public void actionPerformed( ActionEvent e ) {
158
        public void actionPerformed( ActionEvent e ) {
157
            String command = e.getActionCommand();
159
            String command = e.getActionCommand();
158
160
            
159
            if ( COMMAND_OK.equals( command ) ) {
161
            if ( COMMAND_OK.equals( command ) ) {
160
                // Call the OK option listener
162
                // Call the OK option listener
161
                okOptionListener.actionPerformed( e ); // XXX maybe create new event
163
                okOptionListener.actionPerformed( e ); // XXX maybe create new event
164
                actionPerformed(e, categories);
165
            }
166
        }
167
        
168
        private void actionPerformed(ActionEvent e, ProjectCustomizer.Category[] categs) {
169
            for (int i = 0; i < categs.length; i++) {
170
                ActionListener list = categs[i].getOkButtonListener();
171
                if (list != null) {
172
                    actionPerformed(e);// XXX maybe create new event
173
                }
174
                if (categs[i].getSubcategories() != null) {
175
                    actionPerformed(e, categs[i].getSubcategories());
176
                }
162
            }
177
            }
163
164
        }
178
        }
165
179
166
    }
180
    }
(-)src/org/netbeans/spi/project/ui/support/ProjectCustomizer.java (-1 / +28 lines)
Lines 21-26 Link Here
21
21
22
import java.awt.Dialog;
22
import java.awt.Dialog;
23
import java.awt.Image;
23
import java.awt.Image;
24
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
25
import java.awt.event.ActionListener;
25
import java.io.IOException;
26
import java.io.IOException;
26
import java.util.ArrayList;
27
import java.util.ArrayList;
Lines 194-199 Link Here
194
     * Interface for creation of Customizer categories and their respective UI panels.
195
     * Interface for creation of Customizer categories and their respective UI panels.
195
     * Implementations are to be registered in System FileSystem via module layers. Used by the
196
     * Implementations are to be registered in System FileSystem via module layers. Used by the
196
     * {@link org.netbeans.spi.project.ui.support.ProjectCustomizer#createCustomizerDialog(String,Lookup,String,ActionListener,HelpCtx)}
197
     * {@link org.netbeans.spi.project.ui.support.ProjectCustomizer#createCustomizerDialog(String,Lookup,String,ActionListener,HelpCtx)}
198
     * The panel/category created by the provider can get notified that the customizer got
199
     * closed by setting an <code>ActionListener</code> to 
200
     * {@link org.netbeans.spi.project.ui.support.ProjectCustomizer.Category#setOkButtonListener} .
197
     * @since org.netbeans.modules.projectuiapi/1 1.15
201
     * @since org.netbeans.modules.projectuiapi/1 1.15
198
     */
202
     */
199
    public static interface CompositeCategoryProvider {
203
    public static interface CompositeCategoryProvider {
Lines 209-214 Link Here
209
213
210
        /**
214
        /**
211
         * create the UI component for given category and context.
215
         * create the UI component for given category and context.
216
         * The panel/category created by the provider can get notified that the customizer got
217
         * closed by setting an <code>ActionListener</code> to 
218
         * {@link org.netbeans.spi.project.ui.support.ProjectCustomizer.Category#setOkButtonListener}.
212
         * @param category Category instance that was created in the createCategory method.
219
         * @param category Category instance that was created in the createCategory method.
213
         * @param context Lookup instance passed from project The content is up to the project type, please consult documentation
220
         * @param context Lookup instance passed from project The content is up to the project type, please consult documentation
214
         * for the project type you want to integrate your panel into.
221
         * for the project type you want to integrate your panel into.
Lines 226-231 Link Here
226
        private Category[] subcategories;
233
        private Category[] subcategories;
227
        private boolean valid;
234
        private boolean valid;
228
        private String errorMessage;
235
        private String errorMessage;
236
        private ActionListener okListener;
229
        
237
        
230
        /** Private constructor. See the factory method.
238
        /** Private constructor. See the factory method.
231
         */
239
         */
Lines 255-261 Link Here
255
            return new Category( name, displayName, icon, subcategories );
263
            return new Category( name, displayName, icon, subcategories );
256
        }
264
        }
257
        
265
        
258
        
259
        // Public methods ------------------------------------------------------
266
        // Public methods ------------------------------------------------------
260
        
267
        
261
        /** Gets programmatic name of given category.
268
        /** Gets programmatic name of given category.
Lines 334-339 Link Here
334
                Utilities.getCategoryChangeSupport(this).firePropertyChange(
341
                Utilities.getCategoryChangeSupport(this).firePropertyChange(
335
                        CategoryChangeSupport.ERROR_MESSAGE_PROPERTY, oldMessage, message);
342
                        CategoryChangeSupport.ERROR_MESSAGE_PROPERTY, oldMessage, message);
336
            }
343
            }
344
        }
345
        
346
        /**
347
         * set the action listener that will get notified when the changes in the customizer 
348
         * are to be applied.
349
         * @param okButtonListener ActionListener to notify 
350
         * @since org.netbeans.modules.projectuiapi/1 1.20
351
         */ 
352
        public void setOkButtonListener(ActionListener okButtonListener) {
353
            okListener = okButtonListener;
354
        }
355
        
356
        /**
357
         * returns the action listener associated wth this category that gets notified 
358
         * when ok button is pressed on the customizer.
359
         * @returns instance of ActionListener or null if not set.
360
         * @since org.netbeans.modules.projectuiapi/1 1.20
361
         */ 
362
        public ActionListener getOkButtonListener() {
363
            return okListener;
337
        }
364
        }
338
        
365
        
339
    }
366
    }

Return to bug 85405