Changeset 10999 in josm for trunk/src/org/openstreetmap/josm/gui/layer
- Timestamp:
- 2016-09-14T12:44:16+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/LayerManager.java
r10998 r10999 21 21 * This manager handles a list of layers with the first layer being the front layer. 22 22 * <h1>Threading</h1> 23 * Synchronization of the layer manager is done by synchronizing all read/write access. All changes are internally done in the EDT thread. 24 * 23 25 * Methods of this manager may be called from any thread in any order. 24 * Listeners are called while this layer manager is locked, so they should not block .26 * Listeners are called while this layer manager is locked, so they should not block on other threads. 25 27 * 26 28 * @author Michael Zangl … … 35 37 * Notifies this listener that a layer has been added. 36 38 * <p> 37 * Listeners are called in the EDT thread. 39 * Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method. 38 40 * @param e The new added layer event 39 41 */ … … 45 47 * Listeners are called in the EDT thread after the layer was removed. 46 48 * Use {@link LayerRemoveEvent#scheduleRemoval(Collection)} to remove more layers. 49 * You should not do blocking or long-running tasks in this method. 47 50 * @param e The layer to be removed (as event) 48 51 */ … … 52 55 * Notifies this listener that the order of layers was changed. 53 56 * <p> 54 * Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread. 57 * Listeners are called in the EDT thread. 58 * You should not do blocking or long-running tasks in this method. 55 59 * @param e The order change event. 56 60 */ … … 418 422 * @since 10432 419 423 */ 420 public synchronized void resetState() { 421 // some layer remove listeners remove other layers. 424 public void resetState() { 425 // we force this on to the EDT Thread to have a clean synchronization 426 // The synchronization lock needs to be held by the EDT. 427 GuiHelper.runInEDTAndWaitWithException(this::realResetState); 428 } 429 430 protected synchronized void realResetState() { 431 // The listeners trigger the removal of other layers 422 432 while (!getLayers().isEmpty()) { 423 433 removeLayer(getLayers().get(0)); -
trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java
r10997 r10999 372 372 373 373 @Override 374 p ublic synchronized void resetState() {374 protected synchronized void realResetState() { 375 375 // active and edit layer are unset automatically 376 super.re setState();376 super.realResetState(); 377 377 378 378 activeLayerChangeListeners.clear();
Note:
See TracChangeset
for help on using the changeset viewer.