1 19 20 package org.netbeans.modules.form; 21 22 import java.beans.Beans ; 23 import java.beans.Introspector ; 24 import java.util.ArrayList ; 25 import java.util.Arrays ; 26 import java.util.List ; 27 import org.openide.modules.ModuleInstall; 28 29 32 public class FormEditorModule extends ModuleInstall { 33 34 private static final String BEANINFO_PATH_AWT = "org.netbeans.modules.form.beaninfo.awt"; private static final String BEANINFO_PATH_SWING = "org.netbeans.modules.form.beaninfo.swing"; 37 public void restored() { 38 Beans.setDesignTime(true); 39 40 FormPropertyEditorManager.registerEditor( 41 javax.swing.KeyStroke .class, 42 org.netbeans.modules.form.editors.KeyStrokeEditor.class); 43 44 String [] sp = Introspector.getBeanInfoSearchPath(); 46 List paths = new ArrayList (Arrays.asList(sp)); 47 if (!paths.contains(BEANINFO_PATH_AWT)) { 48 paths.add(BEANINFO_PATH_AWT); 49 } 50 if (!paths.contains(BEANINFO_PATH_SWING)) { 51 paths.add(BEANINFO_PATH_SWING); 52 } 53 Introspector.setBeanInfoSearchPath((String [])paths.toArray(new String [paths.size()])); 54 } 55 56 public void uninstalled() { 57 String [] sp = Introspector.getBeanInfoSearchPath(); 59 List paths = new ArrayList (Arrays.asList(sp)); 60 paths.remove(BEANINFO_PATH_AWT); 61 paths.remove(BEANINFO_PATH_SWING); 62 Introspector.setBeanInfoSearchPath((String [])paths.toArray(new String [paths.size()])); 63 } 64 65 } 66 | Popular Tags |