Index: src/org/netbeans/core/NonGui.java =================================================================== RCS file: /cvs/core/src/org/netbeans/core/NonGui.java,v retrieving revision 1.96 diff -u -r1.96 NonGui.java --- src/org/netbeans/core/NonGui.java 27 Feb 2003 22:09:53 -0000 1.96 +++ src/org/netbeans/core/NonGui.java 11 Mar 2003 11:49:25 -0000 @@ -306,13 +306,31 @@ } /** Lazily loads classes */ // #9951 - private final Class getKlass(String cls) { + private static final Class getKlass(String cls) { try { - return Class.forName(cls, false, getClass().getClassLoader()); + return Class.forName(cls, false, NonGui.class.getClassLoader()); } catch (ClassNotFoundException e) { throw new NoClassDefFoundError(e.getLocalizedMessage()); } } + + /** Allow unit tests to call this to perform only property editor + * registration */ + public static final void registerPropertyEditors() { + String[] syspesp = PropertyEditorManager.getEditorSearchPath(); + String[] nbpesp = new String[] { + "org.netbeans.beaninfo.editors", // NOI18N + "org.openide.explorer.propertysheet.editors", // NOI18N + }; + String[] allpesp = new String[syspesp.length + nbpesp.length]; + System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length); + System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length); + PropertyEditorManager.setEditorSearchPath(allpesp); + PropertyEditorManager.registerEditor (java.lang.Character.TYPE, getKlass("org.netbeans.beaninfo.editors.CharEditor")); + PropertyEditorManager.registerEditor(getKlass("[Ljava.lang.String;"), getKlass("org.netbeans.beaninfo.editors.StringArrayEditor")); // NOI18N + // bugfix #28676, register editor for a property which type is array of data objects + PropertyEditorManager.registerEditor(getKlass("[Lorg.openide.loaders.DataObject;"), getKlass("org.netbeans.beaninfo.editors.DataObjectArrayEditor")); // NOI18N + } /** Initialization of the manager. */ @@ -333,19 +351,10 @@ System.arraycopy(nbbisp, 0, allbisp, 0, nbbisp.length); System.arraycopy(sysbisp, 0, allbisp, nbbisp.length, sysbisp.length); Introspector.setBeanInfoSearchPath(allbisp); - String[] syspesp = PropertyEditorManager.getEditorSearchPath(); - String[] nbpesp = new String[] { - "org.netbeans.beaninfo.editors", // NOI18N - "org.openide.explorer.propertysheet.editors", // NOI18N - }; - String[] allpesp = new String[syspesp.length + nbpesp.length]; - System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length); - System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length); - PropertyEditorManager.setEditorSearchPath(allpesp); - PropertyEditorManager.registerEditor (java.lang.Character.TYPE, getKlass("org.netbeans.beaninfo.editors.CharEditor")); - PropertyEditorManager.registerEditor(getKlass("[Ljava.lang.String;"), getKlass("org.netbeans.beaninfo.editors.StringArrayEditor")); // NOI18N - // bugfix #28676, register editor for a property which type is array of data objects - PropertyEditorManager.registerEditor(getKlass("[Lorg.openide.loaders.DataObject;"), getKlass("org.netbeans.beaninfo.editors.DataObjectArrayEditor")); // NOI18N + + registerPropertyEditors(); + + StartLog.logProgress ("PropertyEditors registered"); // NOI18N // ----------------------------------------------------------------------------------------------------- Index: test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java =================================================================== RCS file: /cvs/core/test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java,v retrieving revision 1.1 diff -u -r1.1 FindEditorTest.java --- test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java 26 Nov 2002 13:40:35 -0000 1.1 +++ test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java 11 Mar 2003 11:49:25 -0000 @@ -25,6 +25,9 @@ * @author Jiri Rechtacek */ public class FindEditorTest extends NbTestCase { + static { + org.netbeans.core.NonGui.registerPropertyEditors(); + } public FindEditorTest(String name) { super(name); @@ -53,7 +56,7 @@ } private void assertFind (Class propertyTypeClass, Class editorClass) { - assertNotNull ("PropertyEditor for " + propertyTypeClass + " found.", PropertyEditorManager.findEditor (propertyTypeClass)); + assertNotNull ("PropertyEditor for " + propertyTypeClass + " not found.", PropertyEditorManager.findEditor (propertyTypeClass)); assertEquals ("Editor is instance of ", editorClass, PropertyEditorManager.findEditor (propertyTypeClass).getClass ()); } }