Changeset 1467 in osm for utils/josm/plugins/osmarender


Ignore:
Timestamp:
2006-10-13T21:50:23+02:00 (18 years ago)
Author:
imi
Message:

added josm translation plugins and annotation-tester plugin

Location:
utils/josm/plugins/osmarender
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • utils/josm/plugins/osmarender/build.xml

    r1438 r1467  
    11<project name="osmarender" default="build" basedir=".">
    22
    3         <property name="josm" location="../../../../editors/josm/dist/josm-custom.jar" />
     3        <!--property name="josm" location="../../../../editors/josm/dist/josm-custom.jar" /-->
     4        <property name="josm" location="../../../../../josm/bin" />
     5
    46        <property name="osmarender" location="../../../osmarender" />
    57        <property name="target" location="dist/osmarender.jar" />
  • utils/josm/plugins/osmarender/src/OsmarenderPlugin.java

    r1438 r1467  
    6464                        }
    6565
    66                         try {
    67                                 // store the stuff in data.osm
    68                                 OsmWriter.output(new FileOutputStream(getPluginDir()+"data.osm"), new OsmWriter.All(fromDataSet, true));
     66                        String firefox = Main.pref.get("osmarender.firefox", "firefox");
     67                        boolean retry = false;
     68                        do {
     69                                try {
     70                                        retry = false;
    6971
    70                                 // launch up the viewer
    71                                 String firefox = Main.pref.get("osmarender.firefox", "firefox");
    72                                 Runtime.getRuntime().exec(firefox+" "+getPluginDir()+"osm-map-features.xml");
    73                         } catch (IOException e1) {
    74                                 JOptionPane.showMessageDialog(Main.parent, "Could not launch Osmarender.");
    75                         }
     72                                        // write to plugin dir
     73                                        OsmWriter.output(new FileOutputStream(getPluginDir()+"data.osm"), new OsmWriter.All(fromDataSet, true));
     74
     75                                        // get the exec line
     76                                        String exec = firefox;
     77                                        if (System.getProperty("os.name").startsWith("Windows"))
     78                                                exec += " file:///"+getPluginDir().replace('\\','/').replace(" ","%20")+"osm-map-features.xml\"";
     79                                        else
     80                                                exec += " "+getPluginDir()+"osm-map-features.xml";
     81
     82                                        // launch up the viewer
     83                                        Runtime.getRuntime().exec(exec);
     84                                } catch (IOException e1) {
     85                                        firefox = JOptionPane.showInputDialog(Main.parent, "FireFox not found. Please enter location of firefox executable");
     86                                        if (firefox != null) {
     87                                                Main.pref.put("osmarender.firefox", firefox);
     88                                                retry = true;
     89                                        }
     90                                }
     91                        } while (retry);
    7692                }
    7793        }
     
    8197
    8298        public OsmarenderPlugin() throws IOException {
    83                 JMenuBar menu = Main.main.mainMenu;
     99                JMenuBar menu = Main.main.menu;
    84100                view = null;
    85101                for (int i = 0; i < menu.getMenuCount(); ++i) {
     
    91107                if (view == null) {
    92108                        view = new JMenu(tr("View"));
    93                         Main.main.mainMenu.add(view, 1);
     109                        menu.add(view, 2);
    94110                        view.setVisible(false);
    95111                }
Note: See TracChangeset for help on using the changeset viewer.