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

(-)a/core.ui/src/org/netbeans/core/ui/options/filetypes/FileAssociationsAdvancedOption.java (-64 lines)
Lines 1-64 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * Contributor(s):
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
28
 * Microsystems, Inc. All Rights Reserved.
29
 *
30
 * If you wish your version of this file to be governed by only the CDDL
31
 * or only the GPL Version 2, indicate your decision by adding
32
 * "[Contributor] elects to include this software in this distribution
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
34
 * single choice of license, a recipient has the option to distribute
35
 * your version of this file under either the CDDL, the GPL Version 2 or
36
 * to extend the choice of license to its licensees as provided above.
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
38
 * Version 2 license, then the option applies only if the new code is
39
 * made subject to such option by the copyright holder.
40
 */
41
package org.netbeans.core.ui.options.filetypes;
42
43
import org.netbeans.spi.options.AdvancedOption;
44
import org.netbeans.spi.options.OptionsPanelController;
45
import org.openide.util.NbBundle;
46
47
/** Represents File Associations options panel in miscellaneous category.
48
 * 
49
 * @author Jiri Skrivanek
50
 */
51
public final class FileAssociationsAdvancedOption extends AdvancedOption {
52
53
    public String getDisplayName() {
54
        return NbBundle.getMessage(FileAssociationsAdvancedOption.class, "AdvancedOption.displayName");  //NOI18N
55
    }
56
57
    public String getTooltip() {
58
        return NbBundle.getMessage(FileAssociationsAdvancedOption.class, "AdvancedOption.tooltip");  //NOI18N
59
    }
60
61
    public OptionsPanelController create() {
62
        return new FileAssociationsOptionsPanelController();
63
    }
64
}
(-)a/core.ui/src/org/netbeans/core/ui/options/filetypes/FileAssociationsOptionsPanelController.java (-1 / +5 lines)
Lines 51-57 Link Here
51
 * 
51
 * 
52
 * @author Jiri Skrivanek
52
 * @author Jiri Skrivanek
53
 */
53
 */
54
final class FileAssociationsOptionsPanelController extends OptionsPanelController {
54
@OptionsPanelController.SubRegistration(
55
    displayName="#AdvancedOption.displayName"
56
//    toolTip="#AdvancedOption.tooltip"
57
)
58
public final class FileAssociationsOptionsPanelController extends OptionsPanelController {
55
59
56
    private FileAssociationsPanel panel;
60
    private FileAssociationsPanel panel;
57
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
61
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
(-)a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanelController.java (+9 lines)
Lines 53-58 Link Here
53
 *
53
 *
54
 * @author Jan Jancura
54
 * @author Jan Jancura
55
 */
55
 */
56
@OptionsPanelController.TopLevelRegistration(
57
    categoryName="#CTL_General_Options",
58
    iconBase="org/netbeans/modules/options/resources/generalOptions.png",
59
    keywords="#KW_General",
60
    keywordsCategory="General",
61
//    title="#CTL_General_Options_Title",
62
//    description="#CTL_General_Options_Description",
63
    position=100
64
)
56
public final class GeneralOptionsPanelController extends OptionsPanelController {
65
public final class GeneralOptionsPanelController extends OptionsPanelController {
57
66
58
67
(-)a/core.ui/src/org/netbeans/core/ui/resources/layer.xml (-19 lines)
Lines 796-820 Link Here
796
796
797
    </folder>
797
    </folder>
798
798
799
    <folder name="OptionsDialog">
800
        <folder name="Advanced">
801
            <file name="org-netbeans-core-ui-options-filetypes-FileAssociationsAdvancedOption.instance"/>
802
        </folder>
803
        <file name="General.instance">
804
            <attr name="instanceCreate" methodvalue="org.netbeans.spi.options.OptionsCategory.createCategory"/>
805
806
            <attr name="title" bundlevalue="org.netbeans.core.ui.options.general.Bundle#CTL_General_Options_Title"/>
807
            <attr name="categoryName" bundlevalue="org.netbeans.core.ui.options.general.Bundle#CTL_General_Options"/>
808
            <attr name="iconBase" stringvalue="org/netbeans/modules/options/resources/generalOptions.png"/>
809
            <attr name="controller" newvalue="org.netbeans.core.ui.options.general.GeneralOptionsPanelController"/>
810
            <attr name="keywords" bundlevalue="org.netbeans.core.ui.options.general.Bundle#KW_General"/>
811
            <attr name="keywordsCategory" stringvalue="General"/>
812
            <attr name="description" bundlevalue="org.netbeans.core.ui.options.general.Bundle#CTL_General_Options_Description"/>
813
814
            <attr name="position" intvalue="100"/>
815
        </file>
816
    </folder>
817
818
    <folder name="OptionsExport">
799
    <folder name="OptionsExport">
819
        <folder name="General">
800
        <folder name="General">
820
            <attr name="displayName" bundlevalue="org.netbeans.core.ui.options.general.Bundle#General.Options.Export.Category.displayName"/>
801
            <attr name="displayName" bundlevalue="org.netbeans.core.ui.options.general.Bundle#General.Options.Export.Category.displayName"/>
(-)a/openide.filesystems/src/org/openide/filesystems/annotations/LayerBuilder.java (+32 lines)
Lines 153-158 Link Here
153
        return f;
153
        return f;
154
    }
154
    }
155
155
156
    /**
157
     * Generates an instance file that is <em>not initialized</em> with an instance.
158
     * Useful for {@link LayerGeneratingProcessor}s which define layer fragments
159
     * which indirectly instantiate Java objects from the annotated code via a generic factory method.
160
     * Invoke the factory using {@link File#methodvalue} on {@code instanceCreate}
161
     * and configure it with a {@link File#instanceAttribute} appropriate to the factory.
162
     * <p>While you can pick a specific instance file name, if possible you should pass null for {@code name}
163
     * as using the generated name will help avoid accidental name collisions between annotations.
164
     * @param path path to folder of instance file, e.g. {@code "Menu/File"}
165
     * @param name instance file basename, e.g. {@code "my-menu-Item"}, or null to pick a name according to the element
166
     * @return an instance file (call {@link File#write} to finalize)
167
     * @throws IllegalArgumentException if the builder is not associated with exactly one
168
     *                                  {@linkplain TypeElement class} or {@linkplain ExecutableElement method}
169
     * @throws LayerGenerationException if the associated element would not be loadable as an instance 
170
     * @since XXX
171
     */
172
    public File instanceFile(String path, String name) throws IllegalArgumentException, LayerGenerationException {
173
        String[] clazzOrMethod = instantiableClassOrMethod(null);
174
        String clazz = clazzOrMethod[0];
175
        String method = clazzOrMethod[1];
176
        String basename;
177
        if (name == null) {
178
            basename = clazz.replace('.', '-');
179
            if (method != null) {
180
                basename += "-" + method;
181
            }
182
        } else {
183
            basename = name;
184
        }
185
        return file(path + "/" + basename + ".instance");
186
    }
187
156
    private String[] instantiableClassOrMethod(Class type) throws IllegalArgumentException, LayerGenerationException {
188
    private String[] instantiableClassOrMethod(Class type) throws IllegalArgumentException, LayerGenerationException {
157
        if (originatingElement == null) {
189
        if (originatingElement == null) {
158
            throw new IllegalArgumentException("Only applicable to builders with exactly one associated element");
190
            throw new IllegalArgumentException("Only applicable to builders with exactly one associated element");
(-)a/options.api/nbproject/project.properties (+1 lines)
Lines 41-43 Link Here
41
javac.source=1.5
41
javac.source=1.5
42
javadoc.arch=${basedir}/arch.xml
42
javadoc.arch=${basedir}/arch.xml
43
javadoc.apichanges=${basedir}/apichanges.xml
43
javadoc.apichanges=${basedir}/apichanges.xml
44
cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar
(-)a/options.api/src/org/netbeans/api/options/OptionsDisplayer.java (-20 / +8 lines)
Lines 45-51 Link Here
45
import java.util.logging.Logger;
45
import java.util.logging.Logger;
46
import org.netbeans.modules.options.CategoryModel;
46
import org.netbeans.modules.options.CategoryModel;
47
import org.netbeans.modules.options.OptionsDisplayerImpl;
47
import org.netbeans.modules.options.OptionsDisplayerImpl;
48
import org.netbeans.spi.options.OptionsPanelController.SubRegistration;
49
import org.netbeans.spi.options.OptionsPanelController.TopLevelRegistration;
48
import org.openide.util.Mutex;
50
import org.openide.util.Mutex;
51
49
/**
52
/**
50
 * Permits Options Dialog to open the options dialog with some category pre-selected.
53
 * Permits Options Dialog to open the options dialog with some category pre-selected.
51
 * @since 1.5
54
 * @since 1.5
Lines 80-105 Link Here
80
    }
83
    }
81
    
84
    
82
    /**
85
    /**
83
     * Open the options dialog with some category and subcategory pre-selected
86
     * Open the options dialog with some panel preselected.
84
     * according to given path.
87
     * To open a top-level panel, pass its {@link TopLevelRegistration#id}.
85
     * @param path path of category and subcategories to be selected. Path is 
88
     * To open a subpanel, pass its {@link SubRegistration#location} followed by {@code /}
86
     * composed from registration names divided by slash. E.g. "MyCategory" or 
89
     * followed by its {@link SubRegistration#id}.
87
     * "MyCategory/Subcategory2" for the following registration:
90
     * @param path slash-separated path of category and perhaps subcategories to be selected
88
     * <pre style="background-color: rgb(255, 255, 153);">
89
     * &lt;folder name="OptionsDialog"&gt;
90
     *     &lt;file name="MyCategory.instance"&gt;
91
     *         &lt;attr name="instanceClass" stringvalue="org.foo.MyCategory"/&gt;
92
     *         &lt;attr name="position" intvalue="900"/&gt;
93
     *     &lt;/file&gt;
94
     *     &lt;folder name="MyCategory"&gt;
95
     *         &lt;file name="SubCategory1.instance"&gt;
96
     *             &lt;attr name="instanceClass" stringvalue="org.foo.Subcategory1"/&gt;
97
     *         &lt;/file&gt;
98
     *         &lt;file name="SubCategory2.instance"&gt;
99
     *             &lt;attr name="instanceClass" stringvalue="org.foo.Subcategory2"/&gt;
100
     *         &lt;/file&gt;
101
     *     &lt;/file&gt;
102
     * &lt;/folder&gt;</pre>
103
     * @return true if optins dialog was sucesfully opened with required category.
91
     * @return true if optins dialog was sucesfully opened with required category.
104
     * If this method is called when options dialog is already opened then this method
92
     * If this method is called when options dialog is already opened then this method
105
     * will return immediately false without affecting currently selected category
93
     * will return immediately false without affecting currently selected category
(-)a/options.api/src/org/netbeans/modules/options/AdvancedOptionImpl.java (+1 lines)
Lines 62-67 Link Here
62
    private Callable<OptionsPanelController> controller;
62
    private Callable<OptionsPanelController> controller;
63
    private String keywordsCategory;
63
    private String keywordsCategory;
64
64
65
    @SuppressWarnings("deprecation")
65
    public AdvancedOptionImpl(Callable<OptionsPanelController> controller, String displayName, String tooltip, String keywords, String keywordsCategory) {
66
    public AdvancedOptionImpl(Callable<OptionsPanelController> controller, String displayName, String tooltip, String keywords, String keywordsCategory) {
66
        this.controller = controller;
67
        this.controller = controller;
67
        this.displayName = displayName;
68
        this.displayName = displayName;
(-)a/options.api/src/org/netbeans/modules/options/OptionsPanelControllerProcessor.java (+113 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.options;
41
42
import java.util.Set;
43
import javax.annotation.processing.Processor;
44
import javax.annotation.processing.RoundEnvironment;
45
import javax.annotation.processing.SupportedAnnotationTypes;
46
import javax.annotation.processing.SupportedSourceVersion;
47
import javax.lang.model.SourceVersion;
48
import javax.lang.model.element.Element;
49
import javax.lang.model.element.TypeElement;
50
import org.netbeans.spi.options.AdvancedOption;
51
import org.netbeans.spi.options.OptionsCategory;
52
import org.netbeans.spi.options.OptionsPanelController;
53
import org.netbeans.spi.options.OptionsPanelController.SubRegistration;
54
import org.netbeans.spi.options.OptionsPanelController.TopLevelRegistration;
55
import org.openide.filesystems.annotations.LayerBuilder.File;
56
import org.openide.filesystems.annotations.LayerGeneratingProcessor;
57
import org.openide.filesystems.annotations.LayerGenerationException;
58
import org.openide.util.lookup.ServiceProvider;
59
60
@ServiceProvider(service=Processor.class)
61
@SupportedSourceVersion(SourceVersion.RELEASE_6)
62
@SupportedAnnotationTypes({
63
    "org.netbeans.spi.options.OptionsPanelController.TopLevelRegistration",
64
    "org.netbeans.spi.options.OptionsPanelController.SubRegistration"
65
})
66
public class OptionsPanelControllerProcessor extends LayerGeneratingProcessor {
67
68
    protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
69
        if (roundEnv.processingOver()) {
70
            return false;
71
        }
72
        for (Element e : roundEnv.getElementsAnnotatedWith(TopLevelRegistration.class)) {
73
            TopLevelRegistration r = e.getAnnotation(TopLevelRegistration.class);
74
            File file = layer(e).instanceFile("OptionsDialog", r.id()).
75
                    methodvalue("instanceCreate", OptionsCategory.class.getName(), "createCategory").
76
                    instanceAttribute("controller", OptionsPanelController.class).
77
                    bundlevalue("categoryName", r.categoryName()).
78
                    // XXX verify that the icon exists
79
                    stringvalue("iconBase", r.iconBase()).
80
                    position(r.position());
81
            keywords(e, r.keywords(), r.keywordsCategory(), file);
82
            file.write();
83
        }
84
        for (Element e : roundEnv.getElementsAnnotatedWith(SubRegistration.class)) {
85
            SubRegistration r = e.getAnnotation(SubRegistration.class);
86
            if (r.position() != Integer.MAX_VALUE && r.location().equals("Advanced")) {
87
                throw new LayerGenerationException("position ignored for Advanced subpanels", e);
88
            }
89
            File file = layer(e).instanceFile("OptionsDialog/" + r.location(), r.id()).
90
                    methodvalue("instanceCreate", AdvancedOption.class.getName(), "createSubCategory").
91
                    instanceAttribute("controller", OptionsPanelController.class).
92
                    bundlevalue("displayName", r.displayName()).
93
                    position(r.position());
94
            keywords(e, r.keywords(), r.keywordsCategory(), file);
95
            file.write();
96
        }
97
        return true;
98
    }
99
100
    private void keywords(Element e, String keywords, String keywordsCategory, File file) throws LayerGenerationException {
101
        if (keywords.length() > 0) {
102
            if (keywordsCategory.length() == 0) {
103
                throw new LayerGenerationException("Must specify both keywords and keywordsCategory", e);
104
            }
105
            file.bundlevalue("keywords", keywords).bundlevalue("keywordsCategory", keywordsCategory);
106
        } else {
107
            if (keywordsCategory.length() > 0) {
108
                throw new LayerGenerationException("Must specify both keywords and keywordsCategory", e);
109
            }
110
        }
111
    }
112
113
}
(-)a/options.api/src/org/netbeans/spi/options/AdvancedOption.java (-3 / +9 lines)
Lines 47-55 Link Here
47
47
48
/**
48
/**
49
 * This class represents one category (like "Ant"
49
 * This class represents one category (like "Ant"
50
 * or "Form Editor") in Miscellaneous Panel of Options Dialog. Its instances should
50
 * or "Form Editor") in Miscellaneous Panel of Options Dialog.
51
 * be registered in layers and created by <code>createSubCategory</code> factory
51
 * <p>Normally panels are registered using {@link OptionsPanelController.SubRegistration}.
52
 * method as follows:
52
 * They may also be registered in a layer manually as follows:
53
 *
53
 *
54
 * <pre style="background-color: rgb(255, 255, 153);">
54
 * <pre style="background-color: rgb(255, 255, 153);">
55
 * &lt;folder name="OptionsDialog"&gt;
55
 * &lt;folder name="OptionsDialog"&gt;
Lines 96-101 Link Here
96
    private static final String KEYWORDS_CATEGORY = "keywordsCategory";
96
    private static final String KEYWORDS_CATEGORY = "keywordsCategory";
97
97
98
    /**
98
    /**
99
     * @deprecated Use {@link OptionsPanelController.SubRegistration} instead.
100
     */
101
    @Deprecated
102
    protected AdvancedOption() {}
103
104
    /**
99
     * Returns name of category used in Advanced Panel of 
105
     * Returns name of category used in Advanced Panel of 
100
     * Options Dialog.
106
     * Options Dialog.
101
     *
107
     *
(-)a/options.api/src/org/netbeans/spi/options/OptionsCategory.java (-3 / +3 lines)
Lines 52-60 Link Here
52
52
53
/**
53
/**
54
 * This class represents one category (like "Fonts & Colors"
54
 * This class represents one category (like "Fonts & Colors"
55
 * or "Editor") in Options Dialog. Its instances should
55
 * or "Editor") in Options Dialog.
56
 * be registered in layers and created by <code>createCategory</code> factory
56
 * <p>Normally panels are registered using {@link OptionsPanelController.TopLevelRegistration}.
57
 * method as follows:
57
 * They may also be registered in a layer manually as follows:
58
 *
58
 *
59
 *   <pre style="background-color: rgb(255, 255, 153);">
59
 *   <pre style="background-color: rgb(255, 255, 153);">
60
 *   &lt;folder name="OptionsDialog"&gt;
60
 *   &lt;folder name="OptionsDialog"&gt;
(-)a/options.api/src/org/netbeans/spi/options/OptionsPanelController.java (+69 lines)
Lines 41-46 Link Here
41
package org.netbeans.spi.options;
41
package org.netbeans.spi.options;
42
42
43
import java.beans.PropertyChangeListener;
43
import java.beans.PropertyChangeListener;
44
import java.lang.annotation.ElementType;
45
import java.lang.annotation.Retention;
46
import java.lang.annotation.RetentionPolicy;
47
import java.lang.annotation.Target;
44
import javax.swing.JComponent;
48
import javax.swing.JComponent;
45
import org.netbeans.modules.options.OptionsPanelControllerAccessor;
49
import org.netbeans.modules.options.OptionsPanelControllerAccessor;
46
import org.netbeans.modules.options.advanced.AdvancedPanelController;
50
import org.netbeans.modules.options.advanced.AdvancedPanelController;
Lines 102-108 Link Here
102
     * &lt;/folder&gt;</pre>
106
     * &lt;/folder&gt;</pre>
103
     * @return OptionsPanelController a controller wrapping all AdvancedOption instances found in the folder
107
     * @return OptionsPanelController a controller wrapping all AdvancedOption instances found in the folder
104
     * @since 1.8
108
     * @since 1.8
109
     * @deprecated Use {@link OptionsCategory}{@code .createCategory} with {@code advancedOptionsFolder} instead.
105
     */
110
     */
111
    @Deprecated
106
    public static final OptionsPanelController createAdvanced(String subpath) {
112
    public static final OptionsPanelController createAdvanced(String subpath) {
107
        return new AdvancedPanelController(subpath);
113
        return new AdvancedPanelController(subpath);
108
    }
114
    }
Lines 210-213 Link Here
210
     * @param l a listener to be removed
216
     * @param l a listener to be removed
211
     */
217
     */
212
    public abstract void removePropertyChangeListener (PropertyChangeListener l);
218
    public abstract void removePropertyChangeListener (PropertyChangeListener l);
219
220
    /**
221
     * Registers a simple panel at the top level of the Options dialog.
222
     * Should be placed on a {@link OptionsPanelController} instance.
223
     * @see OptionsCategory
224
     * @since XXX
225
     */
226
    @Target({ElementType.TYPE, ElementType.METHOD})
227
    @Retention(RetentionPolicy.SOURCE)
228
    public @interface TopLevelRegistration {
229
        /**
230
         * Optional path that can be used in {@link OptionsDisplayer#open(String)}.
231
         */
232
        String id() default "";
233
        /** Label shown on the button. You may use {@code #key} syntax. */
234
        String categoryName();
235
        /** Path to icon for the button. */
236
        String iconBase();
237
        /**
238
         * Optional keywords (separated by commas) for use with Quick Search (must also specify {@link #keywordCategory}).
239
         * You may use {@code #key} syntax.
240
         */
241
        String keywords() default "";
242
        /** Keyword category for use with Quick Search (must also specify {@link #keywords}). */
243
        String keywordsCategory() default "";
244
        /** Position relative to other top-level panels. */
245
        int position() default Integer.MAX_VALUE;
246
    }
247
248
    /**
249
     * Registers a subpanel inside a top-level container panel in the Options dialog.
250
     * Should be placed on a {@link OptionsPanelController} instance.
251
     * @see AdvancedOption
252
     * @since XXX
253
     */
254
    @Target({ElementType.TYPE, ElementType.METHOD})
255
    @Retention(RetentionPolicy.SOURCE)
256
    public @interface SubRegistration {
257
        /**
258
         * Optional path that can be used (with {@link #location}) in {@link OptionsDisplayer#open(String)}.
259
         */
260
        String id() default "";
261
        /**
262
         * Location of this panel inside some top-level panel.
263
         * If unspecified, placed in the Miscellaneous panel.
264
         */
265
        String location() default "Advanced";
266
        /** Label shown on the tab. You may use {@code #key} syntax. */
267
        String displayName();
268
        /**
269
         * Optional keywords (separated by commas) for use with Quick Search (must also specify {@link #keywordCategory}).
270
         * You may use {@code #key} syntax.
271
         */
272
        String keywords() default "";
273
        /** Keyword category for use with Quick Search (must also specify {@link #keywords}). */
274
        String keywordsCategory() default "";
275
        /**
276
         * Position relative to sibling subpanels.
277
         * Accepted only for non-default {@link #location} (Miscellaneous panel is sorted alphabetically).
278
         */
279
        int position() default Integer.MAX_VALUE;
280
    }
281
213
}
282
}
(-)a/options.api/test/unit/src/org/netbeans/api/options/MyAdvancedCategory.java (-2 / +1 lines)
Lines 39-49 Link Here
39
package org.netbeans.api.options;
39
package org.netbeans.api.options;
40
40
41
import javax.swing.Icon;
41
import javax.swing.Icon;
42
import javax.swing.ImageIcon;
43
import org.netbeans.spi.options.OptionsCategory;
42
import org.netbeans.spi.options.OptionsCategory;
44
import org.netbeans.spi.options.OptionsPanelController;
43
import org.netbeans.spi.options.OptionsPanelController;
45
import org.openide.util.ImageUtilities;
44
import org.openide.util.ImageUtilities;
46
import org.openide.util.Utilities;
47
45
48
public final class MyAdvancedCategory extends OptionsCategory {
46
public final class MyAdvancedCategory extends OptionsCategory {
49
47
Lines 62-67 Link Here
62
        return "My Advanced Category";
60
        return "My Advanced Category";
63
    }
61
    }
64
62
63
    @SuppressWarnings("deprecation")
65
    public OptionsPanelController create() {
64
    public OptionsPanelController create() {
66
        if(controller == null) {
65
        if(controller == null) {
67
            controller = OptionsPanelController.createAdvanced("MyAdvancedCategory");
66
            controller = OptionsPanelController.createAdvanced("MyAdvancedCategory");
(-)a/options.api/test/unit/src/org/netbeans/api/options/Subcategory1.java (+3 lines)
Lines 52-57 Link Here
52
public class Subcategory1 extends AdvancedOption {
52
public class Subcategory1 extends AdvancedOption {
53
53
54
    public static final String DISPLAY_NAME = "Subcategory1 display name";
54
    public static final String DISPLAY_NAME = "Subcategory1 display name";
55
56
    @SuppressWarnings("deprecation")
57
    public Subcategory1() {}
55
    
58
    
56
    @Override
59
    @Override
57
    public String getDisplayName() {
60
    public String getDisplayName() {
(-)a/options.api/test/unit/src/org/netbeans/api/options/Subcategory2.java (+3 lines)
Lines 54-59 Link Here
54
    public static final String DISPLAY_NAME = "Subcategory2 display name";
54
    public static final String DISPLAY_NAME = "Subcategory2 display name";
55
    public static String currentSubpath;
55
    public static String currentSubpath;
56
56
57
    @SuppressWarnings("deprecation")
58
    public Subcategory2() {}
59
57
    @Override
60
    @Override
58
    public String getDisplayName() {
61
    public String getDisplayName() {
59
        return DISPLAY_NAME;
62
        return DISPLAY_NAME;
(-)a/php.project/src/org/netbeans/modules/php/project/resources/layer.xml (-7 lines)
Lines 179-191 Link Here
179
        </file>
179
        </file>
180
        <folder name="org-netbeans-modules-php-project-ui-options-PHPOptionsCategory">
180
        <folder name="org-netbeans-modules-php-project-ui-options-PHPOptionsCategory">
181
            <attr name="position" intvalue="900"/>
181
            <attr name="position" intvalue="900"/>
182
            <file name="General.instance">
183
                <attr name="instanceCreate" methodvalue="org.netbeans.spi.options.AdvancedOption.createSubCategory"/>
184
                <attr name="controller" newvalue="org.netbeans.modules.php.project.ui.options.PhpOptionsPanelController"/>
185
                <attr name="displayName" bundlevalue="org.netbeans.modules.php.project.ui.options.Bundle#LBL_GeneralOptions"/>
186
                <attr name="toolTip" bundlevalue="org.netbeans.modules.php.project.ui.options.Bundle#LBL_GeneralOptionsTooltip"/>
187
                <attr name="position" intvalue="100"/>
188
            </file>
189
        </folder>
182
        </folder>
190
     </folder>
183
     </folder>
191
    <folder name="Projects">
184
    <folder name="Projects">
(-)a/php.project/src/org/netbeans/modules/php/project/ui/Utils.java (-1 / +2 lines)
Lines 68-73 Link Here
68
import org.netbeans.modules.php.project.PhpProject;
68
import org.netbeans.modules.php.project.PhpProject;
69
import org.netbeans.modules.php.project.PhpVisibilityQuery;
69
import org.netbeans.modules.php.project.PhpVisibilityQuery;
70
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
70
import org.netbeans.modules.php.project.ProjectPropertiesSupport;
71
import org.netbeans.modules.php.project.ui.options.PhpOptionsPanelController;
71
import org.netbeans.spi.project.support.ant.PropertyUtils;
72
import org.netbeans.spi.project.support.ant.PropertyUtils;
72
import org.openide.filesystems.FileObject;
73
import org.openide.filesystems.FileObject;
73
import org.openide.filesystems.FileUtil;
74
import org.openide.filesystems.FileUtil;
Lines 657-663 Link Here
657
     * Display Options dialog with PHP > General panel preselected.
658
     * Display Options dialog with PHP > General panel preselected.
658
     */
659
     */
659
    public static void showGeneralOptionsPanel() {
660
    public static void showGeneralOptionsPanel() {
660
        OptionsDisplayer.getDefault().open(UiUtils.OPTIONS_PATH + "/General"); // NOI18N
661
        OptionsDisplayer.getDefault().open(UiUtils.OPTIONS_PATH + "/" + PhpOptionsPanelController.ID); // NOI18N
661
    }
662
    }
662
663
663
}
664
}
(-)a/php.project/src/org/netbeans/modules/php/project/ui/options/PhpOptionsPanelController.java (+10 lines)
Lines 46-51 Link Here
46
import javax.swing.event.ChangeListener;
46
import javax.swing.event.ChangeListener;
47
import org.netbeans.modules.php.api.phpmodule.PhpInterpreter;
47
import org.netbeans.modules.php.api.phpmodule.PhpInterpreter;
48
import org.netbeans.modules.php.api.phpmodule.PhpProgram.InvalidPhpProgramException;
48
import org.netbeans.modules.php.api.phpmodule.PhpProgram.InvalidPhpProgramException;
49
import org.netbeans.modules.php.api.util.UiUtils;
49
import org.netbeans.modules.php.project.util.PhpUnit;
50
import org.netbeans.modules.php.project.util.PhpUnit;
50
import org.netbeans.spi.options.OptionsPanelController;
51
import org.netbeans.spi.options.OptionsPanelController;
51
import org.openide.util.HelpCtx;
52
import org.openide.util.HelpCtx;
Lines 55-62 Link Here
55
/**
56
/**
56
 * @author Tomas Mysik
57
 * @author Tomas Mysik
57
 */
58
 */
59
@OptionsPanelController.SubRegistration(
60
    displayName="#LBL_GeneralOptions",
61
//    toolTip="#LBL_GeneralOptionsTooltip",
62
    id=PhpOptionsPanelController.ID,
63
    location=UiUtils.OPTIONS_PATH,
64
    position=100
65
)
58
public class PhpOptionsPanelController extends OptionsPanelController implements ChangeListener {
66
public class PhpOptionsPanelController extends OptionsPanelController implements ChangeListener {
59
67
68
    public static final String ID = "General";
69
60
    private PhpOptionsPanel phpOptionsPanel = null;
70
    private PhpOptionsPanel phpOptionsPanel = null;
61
    private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
71
    private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
62
    private volatile boolean changed;
72
    private volatile boolean changed;

Return to bug 171284