Changeset 149 in josm for src/org/openstreetmap/josm/tools


Ignore:
Timestamp:
2006-10-05T22:33:21+02:00 (19 years ago)
Author:
imi
Message:
  • added dynamic loading of plugins
  • removed mappaint (now seperate plugin)
  • fixed UrlLabel for Linux and Mac (untested)
Location:
src/org/openstreetmap/josm/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r113 r149  
    2121
    2222import org.openstreetmap.josm.Main;
     23import org.openstreetmap.josm.plugins.PluginException;
     24import org.openstreetmap.josm.plugins.PluginProxy;
    2325
    2426/**
     
    3537                                JOptionPane.showMessageDialog(Main.parent, "You are out of memory. Strange things may happen.\nPlease restart JOSM and load smaller data sets.");
    3638                                return;
     39                        }
     40                       
     41                        if (e instanceof PluginException) {
     42                                PluginProxy plugin = ((PluginException)e).getPlugin();
     43                                if (plugin != null && !plugin.misbehaving) {
     44                                        JOptionPane.showMessageDialog(Main.parent, tr("The plugin {0} throwed an exception: {1}\nIt may be outdated. Please contact the plugin's autor.\nThis message will not shown again until JOSM is restarted.", plugin.name, e.getMessage()));
     45                                        plugin.misbehaving = true;
     46                                        return;
     47                                }
    3748                        }
    3849                       
  • src/org/openstreetmap/josm/tools/OpenBrowser.java

    r69 r149  
    1414        public static String displayUrl(String url) {
    1515                String os = System.getProperty("os.name");
     16                if (os == null)
     17                        return "unknown operating system";
    1618                try {
    1719                        if (os != null && os.startsWith("Windows"))
    18                                 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
    19                         else {
    20                                 //...
    21                         }
     20                                windows(url);
     21                        else if (os.equals("Linux") || os.equals("Solaris") || os.equals("SunOS") || os.equals("AIX") || os.equals("FreeBSD"))
     22                                linux(url);
     23                        else if (os.equals("Mac OS") || os.equals("Mac OS X"))
     24                                mac(url);
     25                        else
     26                                return "unknown operating system";
    2227                } catch (IOException e) {
    2328                        return e.getMessage();
     
    2530                return null;
    2631        }
     32
     33        private static void windows(String url) throws IOException {
     34                Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
     35        }
     36
     37        private static void linux(String url) throws IOException {
     38                try {
     39                Runtime.getRuntime().exec("gnome-open " + url);
     40        } catch (IOException e) {
     41                Runtime.getRuntime().exec("kfmclient openURL " + url);
     42        }
     43        }
     44
     45        private static void mac(String url) throws IOException {
     46                Runtime.getRuntime().exec("open " + url);
     47        }
    2748}
  • src/org/openstreetmap/josm/tools/UrlLabel.java

    r104 r149  
    1414
    1515        public UrlLabel(String url) {
     16                this (url, url);
     17        }
     18
     19        public UrlLabel(String url, String description) {
    1620                this.url = url;
    1721                setContentType("text/html");
    18                 setText("<html><a href=\""+url+"\">"+url+"</a></html>");
     22                setText("<html><a href=\""+url+"\">"+description+"</a></html>");
    1923                setEditable(false);
    2024                setOpaque(false);
Note: See TracChangeset for help on using the changeset viewer.