Changeset 4720 in josm for trunk/src/org


Ignore:
Timestamp:
2011-12-27T15:38:51+01:00 (9 years ago)
Author:
jttt
Message:

Register EDT checker (by default only for locally compiled josm). It will print stacktrace when something tries to access gui from non EDT thread

File:
1 edited

Legend:

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

    r4681 r4720  
    2424
    2525import javax.swing.JFrame;
     26import javax.swing.RepaintManager;
    2627import javax.swing.SwingUtilities;
    2728
     29import org.jdesktop.swinghelper.debug.CheckThreadViolationRepaintManager;
    2830import org.openstreetmap.josm.Main;
    2931import org.openstreetmap.josm.data.AutosaveTask;
     
    104106                "\t-Djosm.home="+tr("/PATH/TO/JOSM/FOLDER/         ")+tr("Change the folder for all user settings")+"\n\n"+
    105107                tr("note: For some tasks, JOSM needs a lot of memory. It can be necessary to add the following\n" +
    106                 "      Java option to specify the maximum size of allocated memory in megabytes")+":\n"+
    107                 "\t-Xmx...m\n\n"+
    108                 tr("examples")+":\n"+
    109                 "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+
    110                 "\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13\n"+
    111                 "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+
    112                 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+
    113                 "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+
    114                 "\tjava -Xmx400m -jar josm.jar\n\n"+
    115                 tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+"\n"+
    116                 tr("Make sure you load some data if you use --selection.")+"\n"
    117         );
     108                        "      Java option to specify the maximum size of allocated memory in megabytes")+":\n"+
     109                        "\t-Xmx...m\n\n"+
     110                        tr("examples")+":\n"+
     111                        "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+
     112                        "\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13\n"+
     113                        "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+
     114                        "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+
     115                        "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+
     116                        "\tjava -Xmx400m -jar josm.jar\n\n"+
     117                        tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+"\n"+
     118                        tr("Make sure you load some data if you use --selection.")+"\n"
     119                );
    118120    }
    119121
     
    262264            // Main.debug("Main window not maximized");
    263265        }
    264         if(main.menu.fullscreenToggleAction != null)
     266        if(main.menu.fullscreenToggleAction != null) {
    265267            main.menu.fullscreenToggleAction.initial();
     268        }
    266269
    267270        SwingUtilities.invokeLater(new Runnable() {
     
    275278                                tr("Unsaved osm data"),
    276279                                new String[] {tr("Restore"), tr("Cancel"), tr("Discard")}
    277                         );
     280                                );
    278281                        dialog.setContent(
    279282                                trn("JOSM found {0} unsaved osm data layer. ",
     
    300303        }
    301304
     305        if (Main.pref.getBoolean("debug.edt-checker.enable", Version.getInstance().isLocalBuild())) {
     306            // Repaint manager is registered so late for a reason - there is lots of violation during startup process but they don't seem to break anything and are difficult to fix
     307            System.out.println("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to conosole");
     308            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
     309        }
     310
    302311    }
    303312
Note: See TracChangeset for help on using the changeset viewer.