diff --git a/options.api/nbproject/project.xml b/options.api/nbproject/project.xml
--- a/options.api/nbproject/project.xml
+++ b/options.api/nbproject/project.xml
@@ -170,6 +170,11 @@
org.netbeans.modules.settings
+
+ org.openide.util
+
+
+
diff --git a/options.api/test/unit/src/org/netbeans/api/options/IDEInitializer.java b/options.api/test/unit/src/org/netbeans/api/options/IDEInitializer.java
deleted file mode 100644
--- a/options.api/test/unit/src/org/netbeans/api/options/IDEInitializer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * Contributor(s):
- *
- * The Original Software is NetBeans. The Initial Developer of the Original
- * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
- * Microsystems, Inc. All Rights Reserved.
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- */
-
-package org.netbeans.api.options;
-
-import java.beans.PropertyVetoException;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.util.Enumeration;
-import junit.framework.Assert;
-import org.netbeans.junit.Manager;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileSystem;
-import org.openide.filesystems.FileUtil;
-import org.openide.filesystems.LocalFileSystem;
-import org.openide.filesystems.MultiFileSystem;
-import org.openide.filesystems.Repository;
-import org.openide.filesystems.XMLFileSystem;
-import org.openide.util.Lookup;
-import org.openide.util.lookup.Lookups;
-import org.openide.util.lookup.ProxyLookup;
-
-
-/**
- * Inspired by org.netbeans.api.project.TestUtil.
- *
- * @author Miloslav Metelka, Jan Lahoda
- */
-public class IDEInitializer extends ProxyLookup {
-
- public static IDEInitializer DEFAULT_LOOKUP = null;
- private static FileSystem lfs;
-
- static {
- IDEInitializer.class.getClassLoader ().setDefaultAssertionStatus (true);
- System.setProperty ("org.openide.util.Lookup", IDEInitializer.class.getName ());
- Assert.assertEquals (IDEInitializer.class, Lookup.getDefault ().getClass ());
- }
-
- public IDEInitializer () {
- Assert.assertNull (DEFAULT_LOOKUP);
- DEFAULT_LOOKUP = this;
- URL.setURLStreamHandlerFactory (new MyURLHandlerFactory ());
- }
-
- /**
- * Set the global default lookup with the specified content.
- *
- * @param layers xml-layer URLs to be present in the system filesystem.
- * @param instances object instances to be present in the default lookup.
- */
- public static void setup (
- String[] layers,
- Object[] instances
- ) {
- ClassLoader classLoader = IDEInitializer.class.getClassLoader ();
- File workDir = new File (Manager.getWorkDirPath ());
- URL[] urls = new URL [layers.length];
- int i, k = urls.length;
- for (i = 0; i < k; i++)
- urls [i] = classLoader.getResource (layers [i]);
-
- // 1) create repository
- XMLFileSystem systemFS = new XMLFileSystem ();
- lfs = FileUtil.createMemoryFileSystem();
- try {
- systemFS.setXmlUrls (urls);
- } catch (Exception ex) {
- ex.printStackTrace ();
- }
- MyFileSystem myFileSystem = new MyFileSystem (
- new FileSystem [] {lfs, systemFS}
- );
- Repository repository = new Repository (myFileSystem);
-
- Object[] lookupContent = new Object [instances.length + 1];
- lookupContent [0] = repository;
- System.arraycopy (instances, 0, lookupContent, 1, instances.length);
-
- DEFAULT_LOOKUP.setLookups (new Lookup[] {
- Lookups.fixed (lookupContent),
- Lookups.metaInfServices (classLoader),
- Lookups.singleton (classLoader),
- });
- Assert.assertTrue (myFileSystem.isDefault());
- }
-
- public static void cleanWorkDir () {
- try {
- Enumeration en = lfs.getRoot ().getChildren (false);
- while (en.hasMoreElements ())
- ((FileObject) en.nextElement ()).delete ();
- } catch (IOException ex) {
- ex.printStackTrace ();
- }
- }
-
- private static class MyFileSystem extends MultiFileSystem {
- public MyFileSystem (FileSystem[] fileSystems) {
- super (fileSystems);
- try {
- setSystemName ("TestFS");
- } catch (PropertyVetoException ex) {
- ex.printStackTrace();
- }
- }
- }
-
- private static class MyURLHandlerFactory implements URLStreamHandlerFactory {
- public URLStreamHandler createURLStreamHandler(String protocol) {
- if (protocol.equals ("nbfs")) {
- return FileUtil.nbfsURLStreamHandler ();
- }
- return null;
- }
- }
-}
diff --git a/options.api/test/unit/src/org/netbeans/api/options/MyAdvancedCategory.java b/options.api/test/unit/src/org/netbeans/api/options/MyAdvancedCategory.java
deleted file mode 100644
--- a/options.api/test/unit/src/org/netbeans/api/options/MyAdvancedCategory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- *
- * Contributor(s):
- *
- * Portions Copyrighted 2008 Sun Microsystems, Inc.
- */
-package org.netbeans.api.options;
-
-import javax.swing.Icon;
-import org.netbeans.spi.options.OptionsCategory;
-import org.netbeans.spi.options.OptionsPanelController;
-import org.openide.util.ImageUtilities;
-
-public final class MyAdvancedCategory extends OptionsCategory {
-
- private OptionsPanelController controller;
-
- @Override
- public Icon getIcon() {
- return ImageUtilities.loadImageIcon("org/netbeans/modules/options/resources/advanced.png", false);
- }
-
- public String getCategoryName() {
- return "MyAdvancedCategory";
- }
-
- public String getTitle() {
- return "My Advanced Category";
- }
-
- @SuppressWarnings("deprecation")
- public OptionsPanelController create() {
- if(controller == null) {
- controller = OptionsPanelController.createAdvanced("MyAdvancedCategory");
- }
- return controller;
- }
-}
diff --git a/options.api/test/unit/src/org/netbeans/api/options/OptionsDisplayerOpenTest.java b/options.api/test/unit/src/org/netbeans/api/options/OptionsDisplayerOpenTest.java
--- a/options.api/test/unit/src/org/netbeans/api/options/OptionsDisplayerOpenTest.java
+++ b/options.api/test/unit/src/org/netbeans/api/options/OptionsDisplayerOpenTest.java
@@ -50,25 +50,30 @@
import java.awt.Frame;
import java.awt.Dialog;
import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
+import javax.swing.JComponent;
import javax.swing.JDialog;
+import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import org.netbeans.junit.NbTestCase;
import org.netbeans.junit.RandomlyFails;
-import org.netbeans.modules.options.advanced.Advanced;
import org.netbeans.modules.options.advanced.AdvancedPanel;
import org.netbeans.modules.options.advanced.AdvancedPanelController;
import org.netbeans.spi.options.OptionsCategory;
+import org.netbeans.spi.options.OptionsPanelController;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
+import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.lookup.Lookups;
+import org.openide.util.test.MockLookup;
/**
*
@@ -79,11 +84,6 @@
private static final int REPEATER = 10;
private Collection extends RegisteredCategory> all;
Logger log;
- static {
- String[] layers = new String[] {"org/netbeans/api/options/mf-layer.xml"};//NOI18N
- Object[] instances = new Object[] {displayer};
- IDEInitializer.setup(layers,instances);
- }
public OptionsDisplayerOpenTest(String testName) {
super(testName);
@@ -93,11 +93,10 @@
@Override
protected void setUp() throws Exception {
+ MockLookup.setInstances(displayer);
log = Logger.getLogger("[Test - " + getName() + "]");
lookup = Lookups.forPath("OptionsDialog"); // NOI18N
- Lookup.Result result = lookup.lookup(new Lookup.Template(RegisteredCategory.class));
- all = result.allInstances();
- assertTrue(all.size() > 0);
+ all = lookup.lookupAll(RegisteredCategory.class);
}
/**
@@ -122,9 +121,9 @@
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
//calls isValid
- registeredCategory.setInvalid();
+ RegisteredCategory.setInvalid();
//calls getHelpCtx
- registeredCategory.helpChanged();
+ RegisteredCategory.helpChanged();
}
});
} finally {
@@ -137,7 +136,7 @@
//calls applyChanges
close();
}
- registeredCategory.assertThreadingForAllCallsWereTested();
+ RegisteredCategory.assertThreadingForAllCallsWereTested();
}
}
@@ -183,16 +182,16 @@
*/
public void testAdvancedSubcategorySelection() throws Exception {
open(OptionsDisplayer.ADVANCED, true);
- assertEquals("First subcategory should be selected by default.", Subcategory1.DISPLAY_NAME, getSelectedSubcategory(Advanced.class));
+ assertEquals("First subcategory should be selected by default.", "Subcategory1 display name", getSelectedSubcategory("Advanced"));
close();
open(OptionsDisplayer.ADVANCED+"/Subcategory2", true);
- assertEquals("Wrong subcategory selected.", Subcategory2.DISPLAY_NAME, getSelectedSubcategory(Advanced.class));
+ assertEquals("Wrong subcategory selected.", "Subcategory2 display name", getSelectedSubcategory("Advanced"));
close();
open(OptionsDisplayer.ADVANCED+"/UnknownID", true);
- assertEquals("Wrong subcategory selected.", Subcategory2.DISPLAY_NAME, getSelectedSubcategory(Advanced.class));
+ assertEquals("Wrong subcategory selected.", "Subcategory2 display name", getSelectedSubcategory("Advanced"));
close();
open(OptionsDisplayer.ADVANCED+"/Subcategory1", true);
- assertEquals("Wrong subcategory selected.", Subcategory1.DISPLAY_NAME, getSelectedSubcategory(Advanced.class));
+ assertEquals("Wrong subcategory selected.", "Subcategory1 display name", getSelectedSubcategory("Advanced"));
close();
}
@@ -201,25 +200,27 @@
*/
public void testSubcategorySelection() throws Exception {
open("MyAdvancedCategory", true);
- assertEquals("Subcategory2 should be first and selected by default.", Subcategory2.DISPLAY_NAME, getSelectedSubcategory(MyAdvancedCategory.class));
+ assertEquals("Subcategory2 should be first and selected by default.", "Subcategory2 display name", getSelectedSubcategory("MyAdvancedCategory"));
close();
open("MyAdvancedCategory/Subcategory1", true);
- assertEquals("Wrong subcategory selected.", Subcategory1.DISPLAY_NAME, getSelectedSubcategory(MyAdvancedCategory.class));
+ assertEquals("Wrong subcategory selected.", "Subcategory1 display name", getSelectedSubcategory("MyAdvancedCategory"));
close();
open("MyAdvancedCategory/UnknownID", true);
- assertEquals("Wrong subcategory selected.", Subcategory1.DISPLAY_NAME, getSelectedSubcategory(MyAdvancedCategory.class));
+ assertEquals("Wrong subcategory selected.", "Subcategory1 display name", getSelectedSubcategory("MyAdvancedCategory"));
close();
open("MyAdvancedCategory/Subcategory2", true);
- assertEquals("Wrong subcategory selected.", Subcategory2.DISPLAY_NAME, getSelectedSubcategory(MyAdvancedCategory.class));
+ assertEquals("Wrong subcategory selected.", "Subcategory2 display name", getSelectedSubcategory("MyAdvancedCategory"));
close();
open("MyAdvancedCategory/Subcategory2/Subcategory22", true);
- assertEquals("setCurrentSubcategory not called in Subcategory2 controller.", "Subcategory22", Subcategory2.getSubpath());
+ assertEquals("setCurrentSubcategory not called in Subcategory2 controller.", "Subcategory22", Subcategory.currentSubpath);
close();
}
/** Returns display name of subcategory selected in AdvancedPanel. */
- private String getSelectedSubcategory(Class extends OptionsCategory> categoryClass) throws Exception {
- OptionsCategory category = lookup.lookup(categoryClass);
+ private String getSelectedSubcategory(String id) throws Exception {
+ Collection extends OptionsCategory> instances = lookup.lookup(new Lookup.Template(OptionsCategory.class, id, null)).allInstances();
+ assertEquals("got wrong instances for " + id, 1, instances.size());
+ OptionsCategory category = instances.iterator().next();
Method getAdvancedPanelMethod = AdvancedPanelController.class.getDeclaredMethod("getAdvancedPanel", (Class[])null);
getAdvancedPanelMethod.setAccessible(true);
AdvancedPanel advancedPanel = (AdvancedPanel)getAdvancedPanelMethod.invoke(category.create(), (Object[])null);
@@ -302,10 +303,10 @@
displayer.close();
}
- @Override
- protected Level logLevel() {
- return Level.FINE;
- }
+// @Override
+// protected Level logLevel() {
+// return Level.FINE;
+// }
public static class TestDisplayer extends DialogDisplayer implements Runnable {
DialogDescriptor descriptor;
@@ -360,4 +361,53 @@
}
}
}
-}
\ No newline at end of file
+
+ private static abstract class Subcategory extends OptionsPanelController {
+ public void update() {}
+ public void applyChanges() {}
+ public void cancel() {}
+ public boolean isValid() {
+ return true;
+ }
+ public boolean isChanged() {
+ return false;
+ }
+ public JComponent getComponent(Lookup masterLookup) {
+ return new JLabel();
+ }
+ public HelpCtx getHelpCtx() {
+ return null;
+ }
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ static String currentSubpath;
+ public @Override void setCurrentSubcategory(String subpath) {
+ currentSubpath = subpath;
+ }
+ }
+
+ @OptionsPanelController.SubRegistration(
+ displayName="Subcategory1 display name"
+ )
+ public static class Subcategory1a extends Subcategory {}
+
+ @OptionsPanelController.SubRegistration(
+ displayName="Subcategory2 display name"
+ )
+ public static class Subcategory2a extends Subcategory {}
+
+ @OptionsPanelController.SubRegistration(
+ displayName="Subcategory1 display name",
+ location="MyAdvancedCategory",
+ position=102
+ )
+ public static class Subcategory1b extends Subcategory {}
+
+ @OptionsPanelController.SubRegistration(
+ displayName="Subcategory2 display name",
+ location="MyAdvancedCategory",
+ position=101
+ )
+ public static class Subcategory2b extends Subcategory {}
+
+}
diff --git a/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java b/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java
--- a/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java
+++ b/options.api/test/unit/src/org/netbeans/api/options/RegisteredCategory.java
@@ -41,63 +41,35 @@
package org.netbeans.api.options;
-import java.awt.Image;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.HashSet;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import junit.framework.TestCase;
-import org.netbeans.spi.options.OptionsCategory;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx;
-import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
-import org.openide.util.Utilities;
+@OptionsPanelController.TopLevelRegistration(
+ categoryName="CTL_General_Options",
+ iconBase="org/netbeans/modules/options/resources/generalOptions.png"
+)
+public final class RegisteredCategory extends OptionsPanelController {
+ private static PropertyChangeListener propertyChangeListener;
+ private static Collection calls = new HashSet();
-/**
- */
-public final class RegisteredCategory extends OptionsCategory {
- private static Icon icon;
- private static PropertyChangeListener propertyChangeListener;
- private Collection calls = new HashSet();
-
- public void setInvalid() {
- propertyChangeListener.propertyChange(new PropertyChangeEvent(this, OptionsPanelController.PROP_VALID, null, null));
+ public static void setInvalid() {
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(null, OptionsPanelController.PROP_VALID, null, null));
}
- public void helpChanged() {
- propertyChangeListener.propertyChange(new PropertyChangeEvent(this, OptionsPanelController.PROP_HELP_CTX, null, null));
+ public static void helpChanged() {
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(null, OptionsPanelController.PROP_HELP_CTX, null, null));
}
-
- @Override
- public Icon getIcon() {
- if (icon == null) {
- Image image = ImageUtilities.loadImage("org/netbeans/modules/options/resources/generalOptions.png");
- icon = new ImageIcon(image);
- }
- return icon;
- }
-
- public String getCategoryName() {
- return "CTL_General_Options";
- }
-
- public String getTitle() {
- return "CTL_General_Options_Title";
- }
-
- public String getDescription() {
- return "CTL_General_Options_Description";
- }
-
- public void assertThreadingForAllCallsWereTested() {
+ public static void assertThreadingForAllCallsWereTested() {
TestCase.assertTrue(calls.contains("update()"));
TestCase.assertTrue(calls.contains("cancel()"));
TestCase.assertTrue(calls.contains("isValid()"));
@@ -109,9 +81,6 @@
public static String subcategoryID;
- public OptionsPanelController create() {
- return new OptionsPanelController() {
-
public void update() {
TestCase.assertTrue(SwingUtilities.isEventDispatchThread());
calls.add("update()");
@@ -169,6 +138,4 @@
public void removePropertyChangeListener(PropertyChangeListener l) {
propertyChangeListener = null;
}
- };
- }
}
diff --git a/options.api/test/unit/src/org/netbeans/api/options/Subcategory1.java b/options.api/test/unit/src/org/netbeans/api/options/Subcategory1.java
deleted file mode 100644
--- a/options.api/test/unit/src/org/netbeans/api/options/Subcategory1.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- *
- * Contributor(s):
- *
- * Portions Copyrighted 2008 Sun Microsystems, Inc.
- */
-
-package org.netbeans.api.options;
-
-import java.beans.PropertyChangeListener;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import org.netbeans.spi.options.AdvancedOption;
-import org.netbeans.spi.options.OptionsPanelController;
-import org.openide.util.HelpCtx;
-import org.openide.util.Lookup;
-
-/**
- */
-public class Subcategory1 extends AdvancedOption {
-
- public static final String DISPLAY_NAME = "Subcategory1 display name";
-
- @SuppressWarnings("deprecation")
- public Subcategory1() {}
-
- @Override
- public String getDisplayName() {
- return DISPLAY_NAME;
- }
-
- @Override
- public String getTooltip() {
- return "Subcategory1 tooltip";
- }
-
- @Override
- public OptionsPanelController create() {
- return new OptionsPanelController() {
-
- @Override
- public void update() {
- }
-
- @Override
- public void applyChanges() {
- }
-
- @Override
- public void cancel() {
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public boolean isChanged() {
- return false;
- }
-
- @Override
- public JComponent getComponent(Lookup masterLookup) {
- return new JLabel();
- }
-
- @Override
- public HelpCtx getHelpCtx() {
- return null;
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener l) {
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener l) {
- }
- };
- }
-
-}
diff --git a/options.api/test/unit/src/org/netbeans/api/options/Subcategory2.java b/options.api/test/unit/src/org/netbeans/api/options/Subcategory2.java
deleted file mode 100644
--- a/options.api/test/unit/src/org/netbeans/api/options/Subcategory2.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- *
- * Contributor(s):
- *
- * Portions Copyrighted 2008 Sun Microsystems, Inc.
- */
-
-package org.netbeans.api.options;
-
-import java.beans.PropertyChangeListener;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import org.netbeans.spi.options.AdvancedOption;
-import org.netbeans.spi.options.OptionsPanelController;
-import org.openide.util.HelpCtx;
-import org.openide.util.Lookup;
-
-/**
- */
-public class Subcategory2 extends AdvancedOption {
-
- public static final String DISPLAY_NAME = "Subcategory2 display name";
- public static String currentSubpath;
-
- @SuppressWarnings("deprecation")
- public Subcategory2() {}
-
- @Override
- public String getDisplayName() {
- return DISPLAY_NAME;
- }
-
- @Override
- public String getTooltip() {
- return "Subcategory2 tooltip";
- }
-
- /** Needed just for tests. */
- public static String getSubpath() {
- return currentSubpath;
- }
-
- @Override
- public OptionsPanelController create() {
- return new OptionsPanelController() {
-
- @Override
- public void update() {
- }
-
- @Override
- public void applyChanges() {
- }
-
- @Override
- public void cancel() {
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public boolean isChanged() {
- return false;
- }
-
- @Override
- public JComponent getComponent(Lookup masterLookup) {
- return new JLabel();
- }
-
- @Override
- public void setCurrentSubcategory(String subpath) {
- currentSubpath = subpath;
- }
-
- @Override
- public HelpCtx getHelpCtx() {
- return null;
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener l) {
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener l) {
- }
- };
- }
-
-}
diff --git a/options.api/test/unit/src/org/netbeans/api/options/mf-layer.xml b/options.api/test/unit/src/org/netbeans/api/options/mf-layer.xml
deleted file mode 100644
--- a/options.api/test/unit/src/org/netbeans/api/options/mf-layer.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/options.api/test/unit/src/org/netbeans/api/options/package-info.java b/options.api/test/unit/src/org/netbeans/api/options/package-info.java
new file mode 100644
--- /dev/null
+++ b/options.api/test/unit/src/org/netbeans/api/options/package-info.java
@@ -0,0 +1,49 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2009 Sun Microsystems, Inc.
+ */
+
+@ContainerRegistration(
+ id="MyAdvancedCategory",
+ categoryName="MyAdvancedCategory",
+ iconBase="org/netbeans/modules/options/resources/advanced.png",
+ position=900
+)
+package org.netbeans.api.options;
+
+import org.netbeans.spi.options.OptionsPanelController.ContainerRegistration;
+