org.eclipse.emf.common.command
Class IdentityCommand

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

public class IdentityCommand
extends AbstractCommand

A command that always produces the same result.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
AbstractCommand.NonDirtying
 
Field Summary
static IdentityCommand INSTANCE
          An empty instance of this object.
protected  java.util.Collection<?> result
          Keeps track of the result returned from getResult().
 
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
 
Constructor Summary
IdentityCommand()
          Creates an empty instance.
IdentityCommand(java.util.Collection<?> result)
          Creates an instance with the given result collection.
IdentityCommand(java.lang.Object result)
          Creates an instance with a result collection containing the given result object.
IdentityCommand(java.lang.String label)
          Creates an instance with the given label.
IdentityCommand(java.lang.String label, java.util.Collection<?> result)
          Creates an instance with the given label the result collection.
IdentityCommand(java.lang.String label, java.lang.Object result)
          Creates an instance with the given label and a result collection containing the given result object.
IdentityCommand(java.lang.String label, java.lang.String description)
          Creates an instance with the given label and description.
IdentityCommand(java.lang.String label, java.lang.String description, java.util.Collection<?> result)
          Creates an instance with the given label, description, result collection.
IdentityCommand(java.lang.String label, java.lang.String description, java.lang.Object result)
          Creates an instance with the given label, description, and a result collection containing the given result object.
 
Method Summary
 boolean canExecute()
          Returns true.
 void execute()
          Do nothing.
 java.lang.String getDescription()
          Returns a string suitable to help describe the effect of this command.
 java.lang.String getLabel()
          Returns a string suitable to represent the label that identifies this command.
 java.util.Collection<?> getResult()
          Return the identity result.
 void redo()
          Do nothing.
 void undo()
          Do nothing.
 
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
canUndo, chain, dispose, getAffectedObjects, prepare, setDescription, setLabel, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

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


result

protected java.util.Collection<?> result
Keeps track of the result returned from getResult().

Constructor Detail

IdentityCommand

public IdentityCommand()
Creates an empty instance.


IdentityCommand

public IdentityCommand(java.lang.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(java.util.Collection<?> result)
Creates an instance with the given result collection.

Parameters:
result - the result collection.

IdentityCommand

public IdentityCommand(java.lang.String label)
Creates an instance with the given label.

Parameters:
label - the label.

IdentityCommand

public IdentityCommand(java.lang.String label,
                       java.lang.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(java.lang.String label,
                       java.util.Collection<?> result)
Creates an instance with the given label the result collection.

Parameters:
label - the label.
result - the result collection.

IdentityCommand

public IdentityCommand(java.lang.String label,
                       java.lang.String description)
Creates an instance with the given label and description.

Parameters:
label - the label.
description - the description.

IdentityCommand

public IdentityCommand(java.lang.String label,
                       java.lang.String description,
                       java.lang.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(java.lang.String label,
                       java.lang.String description,
                       java.util.Collection<?> result)
Creates an instance with the given label, description, result collection.

Parameters:
label - the label.
description - the description.
result - the result collection.
Method Detail

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 java.lang.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 java.lang.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 java.util.Collection<?> getResult()
Return the identity result.

Specified by:
getResult in interface Command
Overrides:
getResult in class AbstractCommand
Returns:
the identity result.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.