Class IdentityCommand

java.lang.Object
org.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.common.command.IdentityCommand
All Implemented Interfaces:
Command

public class IdentityCommand extends AbstractCommand
A command that always produces the same result.
  • Field Details

    • INSTANCE

      public static final IdentityCommand INSTANCE
      An empty instance of this object.
    • result

      protected Collection<?> result
      Keeps track of the result returned from getResult().
  • Constructor Details

    • IdentityCommand

      public IdentityCommand()
      Creates an empty instance.
    • IdentityCommand

      public IdentityCommand(Object result)
      Creates an instance with a result collection containing the given result object.
      Parameters:
      result - the one object in the result collection.
    • IdentityCommand

      public IdentityCommand(Collection<?> result)
      Creates an instance with the given result collection.
      Parameters:
      result - the result collection.
    • IdentityCommand

      public IdentityCommand(String label)
      Creates an instance with the given label.
      Parameters:
      label - the label.
    • IdentityCommand

      public IdentityCommand(String label, Object result)
      Creates an instance with the given label and a result collection containing the given result object.
      Parameters:
      label - the label.
      result - the one object in the result collection.
    • IdentityCommand

      public IdentityCommand(String label, Collection<?> result)
      Creates an instance with the given label the result collection.
      Parameters:
      label - the label.
      result - the result collection.
    • IdentityCommand

      public IdentityCommand(String label, String description)
      Creates an instance with the given label and description.
      Parameters:
      label - the label.
      description - the description.
    • IdentityCommand

      public IdentityCommand(String label, String description, Object result)
      Creates an instance with the given label, description, and a result collection containing the given result object.
      Parameters:
      label - the label.
      description - the description.
      result - the one object in the result collection.
    • IdentityCommand

      public IdentityCommand(String label, String description, Collection<?> result)
      Creates an instance with the given label, description, result collection.
      Parameters:
      label - the label.
      description - the description.
      result - the result collection.
  • Method Details

    • canExecute

      public boolean canExecute()
      Returns true.
      Specified by:
      canExecute in interface Command
      Overrides:
      canExecute in class AbstractCommand
      Returns:
      true.
    • execute

      public void execute()
      Do nothing.
    • undo

      public void undo()
      Do nothing.
      Specified by:
      undo in interface Command
      Overrides:
      undo in class AbstractCommand
    • redo

      public void redo()
      Do nothing.
    • getLabel

      public String getLabel()
      Description copied from interface: Command
      Returns a string suitable to represent the label that identifies this command.
      Specified by:
      getLabel in interface Command
      Overrides:
      getLabel in class AbstractCommand
      Returns:
      a string suitable to represent the label that identifies this command.
    • getDescription

      public String getDescription()
      Description copied from interface: Command
      Returns a string suitable to help describe the effect of this command.
      Specified by:
      getDescription in interface Command
      Overrides:
      getDescription in class AbstractCommand
      Returns:
      a string suitable to help describe the effect of this command.
    • getResult

      public Collection<?> getResult()
      Return the identity result.
      Specified by:
      getResult in interface Command
      Overrides:
      getResult in class AbstractCommand
      Returns:
      the identity result.