Changeset 207 in josm for src/org/openstreetmap/josm/Main.java
- Timestamp:
- 2007-04-03T17:46:00+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r203 r207 14 14 import java.util.LinkedList; 15 15 import java.util.Map; 16 import java.util.SortedMap; 16 17 import java.util.StringTokenizer; 18 import java.util.TreeMap; 17 19 import java.util.concurrent.Executor; 18 20 import java.util.concurrent.Executors; … … 190 192 191 193 /** 192 * Load all plugins specified in preferences. Has to be called after the complete 193 * GUI has been set up. (post-constructor) 194 */ 195 public void loadPlugins() { 196 if (Main.pref.hasKey("plugins")) { 197 for (String pluginName : Main.pref.get("plugins").split(",")) { 194 * Load all plugins specified in preferences. If the parameter is <code>true</code>, all 195 * early plugins are loaded (before constructor). 196 */ 197 public static void loadPlugins(boolean early) { 198 if (!Main.pref.hasKey("plugins")) 199 return; 200 SortedMap<Integer, Collection<PluginInformation>> p = new TreeMap<Integer, Collection<PluginInformation>>(); 201 for (String pluginName : Main.pref.get("plugins").split(",")) { 202 File pluginFile = new File(pref.getPreferencesDir()+"plugins/"+pluginName+".jar"); 203 if (pluginFile.exists()) { 204 PluginInformation info = new PluginInformation(pluginFile); 205 if (info.early != early) 206 continue; 207 if (!p.containsKey(info.stage)) 208 p.put(info.stage, new LinkedList<PluginInformation>()); 209 p.get(info.stage).add(info); 210 } else { 211 if (early) 212 System.out.println("Plugin not found: "+pluginName); // do not translate 213 else 214 JOptionPane.showMessageDialog(Main.parent, tr("Plugin not found: {0}.", pluginName)); 215 } 216 } 217 for (Collection<PluginInformation> c : p.values()) { 218 for (PluginInformation info : c) { 198 219 try { 199 File pluginFile = new File(pref.getPreferencesDir()+"plugins/"+pluginName+".jar"); 200 if (pluginFile.exists()) { 201 PluginInformation info = new PluginInformation(pluginFile); 202 Class<?> klass = info.loadClass(); 203 ImageProvider.sources.add(0, klass); 204 plugins.add(info.load(klass)); 205 } else 206 JOptionPane.showMessageDialog(Main.parent, tr("Plugin not found: {0}.", pluginName)); 220 Class<?> klass = info.loadClass(); 221 ImageProvider.sources.add(0, klass); 222 System.out.println("loading "+info.name); 223 plugins.add(info.load(klass)); 207 224 } catch (PluginException e) { 208 225 e.printStackTrace(); 209 JOptionPane.showMessageDialog(Main.parent, tr("Could not load plugin {0}.", pluginName)); 226 if (early) 227 System.out.println("Could not load plugin: "+info.name); // do not translate 228 else 229 JOptionPane.showMessageDialog(Main.parent, tr("Could not load plugin {0}.", info.name)); 210 230 } 211 231 } … … 307 327 bounds = !args.containsKey("no-fullscreen") ? new Rectangle(0,0,screenDimension.width,screenDimension.height) : new Rectangle(1000,740); 308 328 309 pleaseWaitDlg = new PleaseWaitDialog();329 pleaseWaitDlg = new PleaseWaitDialog(); 310 330 } 311 331 … … 319 339 if (args.containsKey("selection")) 320 340 for (String s : args.get("selection")) 321 SearchAction.search(s, SearchAction.SearchMode.add );341 SearchAction.search(s, SearchAction.SearchMode.add, false); 322 342 } 323 343
Note:
See TracChangeset
for help on using the changeset viewer.