Changeset 6125 in josm


Ignore:
Timestamp:
2013-08-09T16:08:30+02:00 (7 years ago)
Author:
bastiK
Message:

see #7275 - allow script to handle restart

When JOSM was started with parameter -Djosm.restart=true, a
user request for restart will simply terminate the application
with exit code 9.
The start script is then responsible for the restart.

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

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

    r6084 r6125  
    747747     * @since 3378
    748748     */
    749     public static boolean exitJosm(boolean exit) {
     749    public static boolean exitJosm(boolean exit, int exitCode) {
    750750        if (Main.saveUnsavedModifications()) {
    751751            geometry.remember("gui.geometry");
     
    762762            }
    763763            if (exit) {
    764                 System.exit(0);
     764                System.exit(exitCode);
    765765            }
    766766            return true;
  • trunk/src/org/openstreetmap/josm/actions/ExitAction.java

    r6084 r6125  
    2828    @Override
    2929    public void actionPerformed(ActionEvent e) {
    30         Main.exitJosm(true);
     30        Main.exitJosm(true, 0);
    3131    }
    3232}
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r6111 r6125  
    4343    @Override
    4444    public void actionPerformed(ActionEvent e) {
     45        // If JOSM has been started with property 'josm.restart=true' this means
     46        // it is executed by a start script that can handle restart.
     47        // Request for restart is indicated by exit code 9.
     48        String scriptRestart = System.getProperty("josm.restart");
     49        if ("true".equals(scriptRestart)) {
     50            Main.exitJosm(true, 9);
     51        }
     52       
    4553        try {
    4654            restartJOSM();
     
    6472     */
    6573    public static void restartJOSM() throws IOException {
    66         if (isRestartSupported() && !Main.exitJosm(false)) return;
     74        if (isRestartSupported() && !Main.exitJosm(false, 0)) return;
    6775        try {
    6876            // java binary
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6108 r6125  
    8484        mainFrame.addWindowListener(new WindowAdapter(){
    8585            @Override public void windowClosing(final WindowEvent arg0) {
    86                 Main.exitJosm(true);
     86                Main.exitJosm(true, 0);
    8787            }
    8888        });
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r6084 r6125  
    5151        //System.out.println("Going to handle method "+method+" (short: "+method.getName()+") with event "+args[0]);
    5252        if (method.getName().equals("handleQuit")) {
    53             handled = Main.exitJosm(false);
     53            handled = Main.exitJosm(false, 0);
    5454        } else if (method.getName().equals("handleAbout")) {
    5555            Main.main.menu.about.actionPerformed(null);
Note: See TracChangeset for help on using the changeset viewer.