1 19 package org.netbeans.core.startup; 20 21 import java.io.File ; 22 import java.io.InputStream ; 23 import java.io.OutputStream ; 24 import java.io.PrintWriter ; 25 import org.openide.util.Lookup; 26 27 31 public abstract class CoreBridge { 32 33 private static boolean lookupInitialized; 34 35 public static CoreBridge getDefault () { 36 CoreBridge b = Lookup.getDefault().lookup(CoreBridge.class); 37 if (b == null) { 38 assert lookupInitialized; b = new FakeBridge(); 40 } 41 return b; 42 } 43 44 static void lookupInitialized() { 45 lookupInitialized = true; 46 } 47 48 static void conditionallyLoaderPoolTransaction(boolean begin) { 49 CoreBridge b = Lookup.getDefault().lookup(CoreBridge.class); 50 if (b != null) { 51 b.loaderPoolTransaction(begin); 52 } 53 } 54 static Lookup conditionallyLookupCacheLoad () { 55 CoreBridge b = Lookup.getDefault().lookup(CoreBridge.class); 56 if (b != null) { 57 return b.lookupCacheLoad (); 58 } else { 59 return Lookup.EMPTY; 60 } 61 } 62 63 static void conditionallyPrintStatus (String txt) { 64 CoreBridge b = Lookup.getDefault().lookup(CoreBridge.class); 65 if (b != null) { 66 b.setStatusText(txt); 67 } else { 68 System.err.println(txt); 69 } 70 71 } 72 73 76 protected abstract void attachToCategory (Object category); 79 80 protected abstract void loadDefaultSection ( 81 ManifestSection ms, 82 org.openide.util.lookup.InstanceContent.Convertor<ManifestSection,Object > convertor, 83 boolean add 84 ); 99 100 protected abstract void loadActionSection(ManifestSection.ActionSection s, boolean load) throws Exception ; 108 109 protected abstract void loadLoaderSection(ManifestSection.LoaderSection s, boolean load) throws Exception ; 117 118 protected abstract void loaderPoolTransaction (boolean begin); 122 123 125 public abstract void registerPropertyEditors(); 126 129 protected abstract void loadSettings(); 130 131 public abstract Lookup lookupCacheLoad (); 132 public abstract void lookupCacheStore (Lookup l) throws java.io.IOException ; 133 134 136 public abstract void setStatusText (String status); 137 138 public abstract void initializePlaf (Class uiClass, int uiFontSize, java.net.URL themeURL); 139 140 public abstract void cliUsage(PrintWriter printWriter); 141 142 public abstract int cli( 143 String [] string, 144 InputStream inputStream, 145 OutputStream outputStream, 146 OutputStream errorStream, 147 File file 148 ); 149 150 151 154 private static final class FakeBridge extends CoreBridge { 155 158 protected void attachToCategory (Object category) { 159 160 } 161 162 protected void loadDefaultSection ( 163 ManifestSection ms, 164 org.openide.util.lookup.InstanceContent.Convertor convertor, 165 boolean add 166 ) { 167 } 168 169 protected void loadActionSection(ManifestSection.ActionSection s, boolean load) throws Exception { 170 s.getInstance(); 171 } 172 173 protected void loadLoaderSection(ManifestSection.LoaderSection s, boolean load) throws Exception { 174 } 175 176 protected void loaderPoolTransaction (boolean begin) { 177 } 179 180 protected void addToSplashMaxSteps (int cnt) { 181 } 182 protected void incrementSplashProgressBar () { 183 } 184 185 public Lookup lookupCacheLoad () { 186 return Lookup.EMPTY; 187 } 188 public void lookupCacheStore (Lookup l) throws java.io.IOException { 189 } 190 191 public void setStatusText (String status) { 192 System.err.println("STATUS: " + status); 193 } 194 195 public void initializePlaf (Class uiClass, int uiFontSize, java.net.URL themeURL) { 196 } 197 198 public void cliUsage(PrintWriter printWriter) { 199 } 200 201 public void registerPropertyEditors() { 202 } 203 204 protected void loadSettings() { 205 } 206 207 public int cli(String [] string, InputStream inputStream, OutputStream outputStream, OutputStream errorStream, File file) { 208 return 0; 209 } 210 } 211 212 } 213 | Popular Tags |