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

(-)a/options.api/apichanges.xml (+13 lines)
Lines 75-80 Link Here
75
<!-- ACTUAL CHANGES BEGIN HERE: -->
75
<!-- ACTUAL CHANGES BEGIN HERE: -->
76
76
77
<changes>
77
<changes>
78
    <change id="OptionsDisplayer.openModal">
79
        <api name="OptionsAPI"/>
80
        <summary>API to control whether the options window should be modal or not when opened</summary>
81
        <version major="1" minor="33"/>
82
        <date day="26" month="2" year="2013"/>
83
        <author login="theofanis"/>
84
        <compatibility addition="yes"/>
85
        <description>
86
            Added API to control whether the options window should be modal or not when opened.
87
        </description>
88
        <class package="org.netbeans.api.options" name="OptionsDisplayer"/>
89
        <issue number="207120"/>
90
    </change>
78
    <change id="OptionsPanelController.handleSuccessfulSearch">
91
    <change id="OptionsPanelController.handleSuccessfulSearch">
79
        <api name="OptionsAPI"/>
92
        <api name="OptionsAPI"/>
80
        <summary>API to handle successfull search in some panel in options window</summary>
93
        <summary>API to handle successfull search in some panel in options window</summary>
(-)a/options.api/manifest.mf (-1 / +1 lines)
Lines 2-7 Link Here
2
OpenIDE-Module: org.netbeans.modules.options.api/1
2
OpenIDE-Module: org.netbeans.modules.options.api/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/options/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/options/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/options/resources/mf-layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/options/resources/mf-layer.xml
5
OpenIDE-Module-Specification-Version: 1.32
5
OpenIDE-Module-Specification-Version: 1.33
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Essential-Module: true
7
AutoUpdate-Essential-Module: true
(-)a/options.api/src/org/netbeans/api/options/OptionsDisplayer.java (-2 / +42 lines)
Lines 103-109 Link Here
103
    }
103
    }
104
    
104
    
105
    /**
105
    /**
106
     * Open the options dialog with no guarantee which category is pre-selected.
106
     * Open the options dialog (in non-modal mode) with no guarantee which category is pre-selected.
107
     * @return true if optins dialog was sucesfully opened with some pre-selected
107
     * @return true if optins dialog was sucesfully opened with some pre-selected
108
     * category. If no category is registered at all then false will be returned and
108
     * category. If no category is registered at all then false will be returned and
109
     * options dialog won't be opened.
109
     * options dialog won't be opened.
Lines 134-140 Link Here
134
    }
134
    }
135
    
135
    
136
    /**
136
    /**
137
     * Open the options dialog with some panel preselected.
137
     * Open the options dialog (in non-modal mode) with some panel preselected.
138
     * To open a top-level panel, pass its {@link TopLevelRegistration#id}.
138
     * To open a top-level panel, pass its {@link TopLevelRegistration#id}.
139
     * To open a subpanel, pass its {@link SubRegistration#location} followed by {@code /}
139
     * To open a subpanel, pass its {@link SubRegistration#location} followed by {@code /}
140
     * followed by its {@link SubRegistration#id}.
140
     * followed by its {@link SubRegistration#id}.
Lines 182-187 Link Here
182
        }
182
        }
183
    }
183
    }
184
184
185
    /**
186
     * Open the options dialog with no guarantee which category is pre-selected.
187
     * @param isModal true if the options window should be in modal mode, false otherwise
188
     * @return true if options dialog was successfully opened with some pre-selected
189
     * category. If no category is registered at all then false will be returned and
190
     * options dialog won't be opened.
191
     * @since 1.33
192
     */
193
    public boolean open(boolean isModal) {
194
	impl.setIsModal(isModal);
195
	return open();
196
    }
197
198
    /**
199
     * Open the options dialog with some panel preselected.
200
     * To open a top-level panel, pass its {@link TopLevelRegistration#id}.
201
     * To open a subpanel, pass its {@link SubRegistration#location} followed by {@code /}
202
     * followed by its {@link SubRegistration#id}.
203
     * To open a container panel without specifying a particular subpanel, pass its {@link ContainerRegistration#id}.
204
     * To avoid typos and keep track of dependencies it is recommended to define compile-time
205
     * constants for all these IDs, to be used both by the annotations and by calls to this method.
206
     * @param path slash-separated path of category and perhaps subcategories to be selected
207
     * @param isModal true if the options window should be in modal mode, false otherwise
208
     * @return true if options dialog was successfully opened with required category.
209
     * If this method is called when options dialog is already opened then this method
210
     * will return immediately false without affecting currently selected category
211
     * in opened options dialog.
212
     * If category (i.e. the first item in the path) does not correspond to any
213
     * of registered categories then false is returned and options dialog is not opened
214
     * at all (e.g. in case that module providing such category is not installed or enabled).
215
     * If subcategory doesn't exist, it opens with category selected and
216
     * it returns true. It is up to particular <code>OptionsPanelController</code>
217
     * to handle such situation.
218
     * @since 1.33
219
     */
220
    public boolean open(String path, boolean isModal) {
221
	impl.setIsModal(isModal);
222
	return open(path);
223
    }
224
185
    private boolean openImpl(final String path) {
225
    private boolean openImpl(final String path) {
186
        if(path == null) {
226
        if(path == null) {
187
            log.warning("Category to open is null."); //NOI18N
227
            log.warning("Category to open is null."); //NOI18N
(-)a/options.api/src/org/netbeans/modules/options/OptionsDisplayerImpl.java (+4 lines)
Lines 127-132 Link Here
127
            Exceptions.printStackTrace(ex);
127
            Exceptions.printStackTrace(ex);
128
        }
128
        }
129
    }
129
    }
130
131
    public void setIsModal(boolean isModal) {
132
	this.modal = isModal;
133
    }
130
    
134
    
131
    public boolean isOpen() {
135
    public boolean isOpen() {
132
        return dialog != null;
136
        return dialog != null;
(-)a/options.api/test/unit/src/org/netbeans/api/options/OptionsDisplayerOpenTest.java (+18 lines)
Lines 279-284 Link Here
279
            }
279
            }
280
        }
280
        }
281
    }
281
    }
282
283
    public void testModality() throws Exception {
284
	OptionsDisplayer.getDefault().open(false) ;
285
	modality(displayer.descriptor, false);
286
	close();
287
288
	TestDisplayer td = new TestDisplayer();
289
	td.createDialog(new DialogDescriptor(displayer, null, true, null));
290
	OptionsDisplayer.getDefault().open(true) ;
291
	modality(td.descriptor, true);
292
	close();
293
    }
294
295
    public void modality(DialogDescriptor desc, boolean expectedResult) {
296
        if (desc != null) {
297
            assertEquals(expectedResult, desc.isModal());
298
        }
299
    }
282
    
300
    
283
    public void open(boolean expectedResult) {
301
    public void open(boolean expectedResult) {
284
        modality(displayer.descriptor);
302
        modality(displayer.descriptor);

Return to bug 207120