Ignore:
Timestamp:
2007-04-03T17:46:00+02:00 (17 years ago)
Author:
imi
Message:
  • added "case sensitive" option to search dialog
  • added a plugin manifest option "Plugin-Stage" to specify boot stage order (default is 50, smaller first)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/Main.java

    r203 r207  
    1414import java.util.LinkedList;
    1515import java.util.Map;
     16import java.util.SortedMap;
    1617import java.util.StringTokenizer;
     18import java.util.TreeMap;
    1719import java.util.concurrent.Executor;
    1820import java.util.concurrent.Executors;
     
    190192
    191193        /**
    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) {
    198219                                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));
    207224                                } catch (PluginException e) {
    208225                                        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));
    210230                                }
    211231                        }
     
    307327                        bounds = !args.containsKey("no-fullscreen") ? new Rectangle(0,0,screenDimension.width,screenDimension.height) : new Rectangle(1000,740);
    308328
    309                 pleaseWaitDlg = new PleaseWaitDialog();
     329                        pleaseWaitDlg = new PleaseWaitDialog();
    310330        }
    311331
     
    319339                if (args.containsKey("selection"))
    320340                        for (String s : args.get("selection"))
    321                                 SearchAction.search(s, SearchAction.SearchMode.add);
     341                                SearchAction.search(s, SearchAction.SearchMode.add, false);
    322342        }
    323343
Note: See TracChangeset for help on using the changeset viewer.