Ignore:
Timestamp:
2016-06-21T23:41:42+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13019 - Make commands trigger an implicit layer redraw (patch by michael2402) - gsoc-core

Location:
trunk/src/org/openstreetmap/josm/command
Files:
2 edited

Legend:

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

    r10413 r10452  
    148148     * Executes the command on the dataset. This implementation will remember all
    149149     * primitives returned by fillModifiedData for restoring them on undo.
     150     * <p>
     151     * The layer should be invalidated after execution so that it can be re-painted.
    150152     * @return true
     153     * @see #invalidateAffectedLayers()
    151154     */
    152155    public boolean executeCommand() {
     
    300303                Objects.equals(layer, command.layer);
    301304    }
     305
     306    /**
     307     * Invalidate all layers that were affected by this command.
     308     * @see Layer#invalidate()
     309     */
     310    public void invalidateAffectedLayers() {
     311        OsmDataLayer layer = getLayer();
     312        if (layer != null) {
     313            layer.invalidate();
     314        }
     315    }
    302316}
  • trunk/src/org/openstreetmap/josm/command/SequenceCommand.java

    r9377 r10452  
    126126
    127127    @Override
     128    public void invalidateAffectedLayers() {
     129        super.invalidateAffectedLayers();
     130        for (Command c : sequence) {
     131            c.invalidateAffectedLayers();
     132        }
     133    }
     134
     135    @Override
    128136    public int hashCode() {
    129137        return Objects.hash(super.hashCode(), Arrays.hashCode(sequence), sequenceComplete, name, continueOnError);
Note: See TracChangeset for help on using the changeset viewer.