Class UndoableCommand

java.lang.Object
com.vividsolutions.jump.workbench.model.UndoableCommand

public abstract class UndoableCommand extends Object
An action that can be rolled back. Similar to an UndoableEdit, but assumes that the action is yet to be executed, whereas an UndoableEdit assumes that the action has already been executed (i.e. it has a #redo method but not a #do method).
See Also:
  • Field Details

  • Constructor Details

    • UndoableCommand

      public UndoableCommand(String name)
      UndoableCommand with a name to be shown in the user interface.
    • UndoableCommand

      public UndoableCommand(String name, Layer layer)
      UndoableCommand with a name and a layer parameter. The layer parameter is used to neutralize the undoableEdit if the layer is removed from the LayerManager (neutralization uses significant attribute).
  • Method Details

    • setLayer

      public void setLayer(Layer layer)
    • getLayer

      public Layer getLayer()
    • dispose

      protected void dispose()
      Releases resources and make the edit action unsignificant, so that it will be ignored in the undo chain. If a UndoableCommand subclasse has resources to be released, oveload this method and call super.dispose() set canceled to true.
    • isCanceled

      public boolean isCanceled()
    • execute

      public abstract void execute()
      If there is an exception that leaves this UndoableCommand execution partially complete and non-unexecutable, be sure to call #reportIrreversibleChange() on the UndoableEditReceiver (which can be obtained from the LayerManager).
      See Also:
    • unexecute

      public abstract void unexecute()
    • toUndoableEdit

      public UndoableEdit toUndoableEdit()
    • getName

      public String getName()