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

(-)src/org/netbeans/core/NonGui.java (-15 / +24 lines)
Lines 306-318 Link Here
306
    }
306
    }
307
    
307
    
308
    /** Lazily loads classes */ // #9951
308
    /** Lazily loads classes */ // #9951
309
    private final Class getKlass(String cls) {
309
    private static final Class getKlass(String cls) {
310
        try {
310
        try {
311
            return Class.forName(cls, false, getClass().getClassLoader());
311
            return Class.forName(cls, false, NonGui.class.getClassLoader());
312
        } catch (ClassNotFoundException e) {
312
        } catch (ClassNotFoundException e) {
313
            throw new NoClassDefFoundError(e.getLocalizedMessage());
313
            throw new NoClassDefFoundError(e.getLocalizedMessage());
314
        }
314
        }
315
    }
315
    }
316
    
317
    /** Allow unit tests to call this to perform only property editor 
318
     *  registration */
319
    public static final void registerPropertyEditors() {
320
        String[] syspesp = PropertyEditorManager.getEditorSearchPath();
321
        String[] nbpesp = new String[] {
322
            "org.netbeans.beaninfo.editors", // NOI18N
323
            "org.openide.explorer.propertysheet.editors", // NOI18N
324
        };
325
        String[] allpesp = new String[syspesp.length + nbpesp.length];
326
        System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length);
327
        System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length);
328
        PropertyEditorManager.setEditorSearchPath(allpesp);
329
        PropertyEditorManager.registerEditor (java.lang.Character.TYPE, getKlass("org.netbeans.beaninfo.editors.CharEditor"));
330
        PropertyEditorManager.registerEditor(getKlass("[Ljava.lang.String;"), getKlass("org.netbeans.beaninfo.editors.StringArrayEditor")); // NOI18N
331
        // bugfix #28676, register editor for a property which type is array of data objects
332
        PropertyEditorManager.registerEditor(getKlass("[Lorg.openide.loaders.DataObject;"), getKlass("org.netbeans.beaninfo.editors.DataObjectArrayEditor")); // NOI18N
333
    }
316
334
317
    /** Initialization of the manager.
335
    /** Initialization of the manager.
318
    */
336
    */
Lines 333-351 Link Here
333
        System.arraycopy(nbbisp, 0, allbisp, 0, nbbisp.length);
351
        System.arraycopy(nbbisp, 0, allbisp, 0, nbbisp.length);
334
        System.arraycopy(sysbisp, 0, allbisp, nbbisp.length, sysbisp.length);
352
        System.arraycopy(sysbisp, 0, allbisp, nbbisp.length, sysbisp.length);
335
        Introspector.setBeanInfoSearchPath(allbisp);
353
        Introspector.setBeanInfoSearchPath(allbisp);
336
        String[] syspesp = PropertyEditorManager.getEditorSearchPath();
354
        
337
        String[] nbpesp = new String[] {
355
        registerPropertyEditors();
338
            "org.netbeans.beaninfo.editors", // NOI18N
356
        
339
            "org.openide.explorer.propertysheet.editors", // NOI18N
357
        
340
        };
341
        String[] allpesp = new String[syspesp.length + nbpesp.length];
342
        System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length);
343
        System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length);
344
        PropertyEditorManager.setEditorSearchPath(allpesp);
345
        PropertyEditorManager.registerEditor (java.lang.Character.TYPE, getKlass("org.netbeans.beaninfo.editors.CharEditor"));
346
        PropertyEditorManager.registerEditor(getKlass("[Ljava.lang.String;"), getKlass("org.netbeans.beaninfo.editors.StringArrayEditor")); // NOI18N
347
        // bugfix #28676, register editor for a property which type is array of data objects
348
        PropertyEditorManager.registerEditor(getKlass("[Lorg.openide.loaders.DataObject;"), getKlass("org.netbeans.beaninfo.editors.DataObjectArrayEditor")); // NOI18N
349
        StartLog.logProgress ("PropertyEditors registered"); // NOI18N
358
        StartLog.logProgress ("PropertyEditors registered"); // NOI18N
350
359
351
        // -----------------------------------------------------------------------------------------------------
360
        // -----------------------------------------------------------------------------------------------------
(-)test/unit/src/org/netbeans/beaninfo/editors/FindEditorTest.java (-1 / +4 lines)
Lines 25-30 Link Here
25
 * @author Jiri Rechtacek
25
 * @author Jiri Rechtacek
26
 */
26
 */
27
public class FindEditorTest extends NbTestCase {
27
public class FindEditorTest extends NbTestCase {
28
    static {
29
        org.netbeans.core.NonGui.registerPropertyEditors();
30
    }
28
    
31
    
29
    public FindEditorTest(String name) {
32
    public FindEditorTest(String name) {
30
        super(name);
33
        super(name);
Lines 53-59 Link Here
53
    }
56
    }
54
    
57
    
55
    private void assertFind (Class propertyTypeClass, Class editorClass) {
58
    private void assertFind (Class propertyTypeClass, Class editorClass) {
56
        assertNotNull ("PropertyEditor for " + propertyTypeClass + " found.", PropertyEditorManager.findEditor (propertyTypeClass));
59
        assertNotNull ("PropertyEditor for " + propertyTypeClass + " not found.", PropertyEditorManager.findEditor (propertyTypeClass));
57
        assertEquals ("Editor is instance of ", editorClass, PropertyEditorManager.findEditor (propertyTypeClass).getClass ());
60
        assertEquals ("Editor is instance of ", editorClass, PropertyEditorManager.findEditor (propertyTypeClass).getClass ());
58
    }
61
    }
59
}
62
}

Return to bug 31879