Ignore:
Timestamp:
2006-10-01T19:45:33+02:00 (18 years ago)
Author:
imi
Message:
  • added plugin system
  • added plugin: mappainter (thanks NickW!)
File:
1 edited

Legend:

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

    r142 r144  
    1212import java.net.URISyntaxException;
    1313import java.util.Collection;
     14import java.util.LinkedList;
    1415import java.util.Map;
    1516import java.util.StringTokenizer;
     
    5556import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    5657import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
     58import org.openstreetmap.josm.plugins.Plugin;
    5759import org.openstreetmap.josm.tools.ImageProvider;
    5860
     
    8890         */
    8991        public static MapFrame map;
     92        /**
     93         * All installed and loaded plugins (resp. their main classes)
     94         */
     95        public final Collection<Plugin> plugins = new LinkedList<Plugin>();
    9096
    9197        /**
     
    118124                }
    119125                redoUndoListener.commandChanged(0,0);
     126
     127                for (Plugin plugin : plugins)
     128                        plugin.mapFrameInitialized(map);
    120129        }
    121130
     
    236245
    237246                contentPane.updateUI();
     247               
     248                // Plugins
     249                if (pref.hasKey("plugins")) {
     250                        for (String pluginName : pref.get("plugins").split(",")) {
     251                                try {
     252                        plugins.add((Plugin)Class.forName(pluginName).newInstance());
     253                } catch (Exception e) {
     254                        e.printStackTrace();
     255                        JOptionPane.showMessageDialog(parent, tr("Could not load plugin {0}.", pluginName));
     256                }
     257                        }
     258                }
    238259        }
    239260        /**
Note: See TracChangeset for help on using the changeset viewer.