1 19 package org.netbeans.core; 20 21 import java.beans.PropertyEditorManager ; 22 import java.io.File ; 23 import java.io.InputStream ; 24 import java.io.OutputStream ; 25 import java.io.PrintWriter ; 26 import org.netbeans.core.startup.Main; 27 import org.netbeans.core.startup.ManifestSection; 28 29 33 public final class CoreBridgeImpl extends org.netbeans.core.startup.CoreBridge 34 implements Runnable { 35 36 private int numberOfCLIInvocations; 37 38 39 protected void attachToCategory (Object category) { 40 ModuleActions.attachTo(category); 41 } 42 43 protected void loadDefaultSection ( 44 org.netbeans.core.startup.ManifestSection s, 45 org.openide.util.lookup.InstanceContent.Convertor<ManifestSection,Object > convertor, 46 boolean load 47 ) { 48 if (load) { 49 if (convertor != null) { 50 NbTopManager.get().register(s, convertor); 51 } else { 52 NbTopManager.get().register(s); 53 } 54 } else { 55 if (convertor != null) { 56 NbTopManager.get().unregister(s, convertor); 57 } else { 58 NbTopManager.get().unregister(s); 59 } 60 } 61 } 62 63 protected void loadActionSection(ManifestSection.ActionSection s, boolean load) throws Exception { 64 if (load) { 65 ModuleActions.add(s); 66 } else { 67 ModuleActions.remove(s); 68 } 69 } 70 71 protected void loadLoaderSection(ManifestSection.LoaderSection s, boolean load) throws Exception { 72 if (load) { 73 LoaderPoolNode.add(s); 74 } else { 75 LoaderPoolNode.remove((org.openide.loaders.DataLoader)s.getInstance()); 76 } 77 } 78 79 protected void loaderPoolTransaction (boolean begin) { 80 if (begin) { 81 LoaderPoolNode.beginUpdates(); 82 } else { 83 LoaderPoolNode.endUpdates(); 84 } 85 } 86 87 public void setStatusText (String status) { 88 org.openide.awt.StatusDisplayer.getDefault().setStatusText(status); 89 } 90 91 public void initializePlaf (Class uiClass, int uiFontSize, java.net.URL themeURL) { 92 org.netbeans.swing.plaf.Startup.run(uiClass, uiFontSize, themeURL); 93 } 94 95 public org.openide.util.Lookup lookupCacheLoad () { 96 return LookupCache.load (); 97 } 98 public void lookupCacheStore (org.openide.util.Lookup l) throws java.io.IOException { 99 LookupCache.store (l); 100 } 101 102 public void cliUsage(PrintWriter printWriter) { 103 } 105 106 public int cli( 107 String [] string, 108 InputStream inputStream, 109 OutputStream outputStream, 110 OutputStream errorStream, 111 File file 112 ) { 113 126 127 if (numberOfCLIInvocations++ == 0) return 0; 128 129 136 javax.swing.SwingUtilities.invokeLater (this); 137 138 return 0; 139 } 140 141 public void run () { 142 java.awt.Frame f = org.openide.windows.WindowManager.getDefault ().getMainWindow (); 143 144 f.setVisible(true); 146 if ((f.getExtendedState () & java.awt.Frame.ICONIFIED) != 0) { 148 f.setExtendedState (~java.awt.Frame.ICONIFIED & f.getExtendedState ()); 149 } 150 f.toFront (); 152 153 } 154 155 public void registerPropertyEditors() { 156 doRegisterPropertyEditors(); 157 } 158 159 162 private static boolean editorsRegistered=false; 163 167 private static final void doRegisterPropertyEditors() { 168 if (editorsRegistered) return; 170 String [] syspesp = PropertyEditorManager.getEditorSearchPath(); 171 String [] nbpesp = new String [] { 172 "org.netbeans.beaninfo.editors", "org.openide.explorer.propertysheet.editors", }; 175 String [] allpesp = new String [syspesp.length + nbpesp.length]; 176 System.arraycopy(nbpesp, 0, allpesp, 0, nbpesp.length); 177 System.arraycopy(syspesp, 0, allpesp, nbpesp.length, syspesp.length); 178 PropertyEditorManager.setEditorSearchPath(allpesp); 179 PropertyEditorManager.registerEditor (java.lang.Character.TYPE, org.netbeans.beaninfo.editors.CharEditor.class); 180 PropertyEditorManager.registerEditor(String [].class, org.netbeans.beaninfo.editors.StringArrayEditor.class); 181 PropertyEditorManager.registerEditor(org.openide.loaders.DataObject[].class, org.netbeans.beaninfo.editors.DataObjectArrayEditor.class); 183 PropertyEditorManager.registerEditor (Integer.TYPE, org.netbeans.beaninfo.editors.IntEditor.class); 185 PropertyEditorManager.registerEditor (Boolean.TYPE, org.netbeans.beaninfo.editors.BoolEditor.class); 186 editorsRegistered = true; 187 } 188 189 protected void loadSettings() {} 190 191 } 192 | Popular Tags |