Ticket #10350: 10350.core.patch

File 10350.core.patch, 962 bytes (added by simon04, 6 years ago)
  • src/org/openstreetmap/josm/actions/JosmAction.java

    diff --git a/src/org/openstreetmap/josm/actions/JosmAction.java b/src/org/openstreetmap/josm/actions/JosmAction.java
    index 8839de8..c33a258 100644
    a b public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 
    307307            updateEnabledState(newSelection);
    308308        }
    309309    }
     310
     311    /**
     312     * Determines whether the current method (most useful: {@link #updateEnabledState()}) has been called from
     313     * {@link LayerChangeAdapter#activeLayerChange}.
     314     */
     315    protected boolean isCalledFromLayerChange() {
     316        for (StackTraceElement i : Thread.currentThread().getStackTrace()) {
     317            if (LayerChangeAdapter.class.getName().equals(i.getClassName()) && i.getMethodName().contains("activeLayerChange")) {
     318                return true;
     319            }
     320        }
     321        return false;
     322    }
    310323}