Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse GEF
3.3

org.eclipse.gef.commands
Class CompoundCommand

java.lang.Object
  extended by

org.eclipse.gef.commands.Command
      extended by
org.eclipse.gef.commands.CompoundCommand
Direct Known Subclasses:
ForwardUndoCompoundCommand

public class CompoundCommand
extends Command

An aggregation of multiple Commands. A CompoundCommand is executable if all of its contained Commands are executable, and it has at least one contained Command. The same is true for undo. When undo is called, the contained Commands are undone in the reverse order in which they were executed.

An empty CompoundCommand is not executable.

A CompoundCommand can be unwrapped. Unwrapping returns the simplest equivalent form of the CompoundCommand. So, if a CompoundCommand contains just one Command, that Command is returned.


Constructor Summary
CompoundCommand ()
          Constructs an empty CompoundCommand
CompoundCommand (java.lang.String label)
          Constructs an empty CompoundCommand with the specified label.
 
Method Summary
 void add ( Command command)
          Adds the specified command if it is not null.
 boolean canExecute ()
           
 boolean canUndo ()
           
 void dispose ()
          Disposes all contained Commands.
 void execute ()
          Execute the command.For a compound command this means executing all of the commands that it contains.
 java.lang.Object[] getChildren ()
          This is useful when implementing ITreeContentProvider.getChildren(Object) to display the Command's nested structure.
 java.util.List getCommands ()
           
 java.lang.String getLabel ()
           
 boolean isEmpty ()
           
 void redo ()
          Re-executes the Command.
 int size ()
           
 void undo ()
          Undoes the changes performed during execute().
  Command unwrap ()
          Returns the simplest form of this Command that is equivalent.
 
Methods inherited from class org.eclipse.gef.commands. Command
chain, getDebugLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompoundCommand

public CompoundCommand()
Constructs an empty CompoundCommand

Since:
2.0

CompoundCommand

public CompoundCommand(java.lang.String label)
Constructs an empty CompoundCommand with the specified label.

Parameters:
label - the label for the Command
Method Detail

add

public void add(
Command command)
Adds the specified command if it is not null.

Parameters:
command - null or a Command

canExecute

public boolean canExecute()
Overrides:
canExecute in class Command
Returns:
true if the command can be executed
See Also:
Command.canExecute()

canUndo

public boolean canUndo()
Overrides:
canUndo in class Command
Returns:
true if the command can be undone. This method should only be called after execute() or redo() has been called.
See Also:
Command.canUndo()

dispose

public void dispose()
Disposes all contained Commands.

Overrides:
dispose in class Command
See Also:
Command.dispose()

execute

public void execute()
Execute the command.For a compound command this means executing all of the commands that it contains.

Overrides:
execute in class Command

getChildren

public java.lang.Object[] getChildren()
This is useful when implementing ITreeContentProvider.getChildren(Object) to display the Command's nested structure.

Returns:
returns the Commands as an array of Objects.

getCommands

public java.util.List getCommands()
Returns:
the List of contained Commands

getLabel

public java.lang.String getLabel()
Overrides:
getLabel in class Command
Returns:
a String used to describe this command to the User
See Also:
Command.getLabel()

isEmpty

public boolean isEmpty()
Returns:
true if the CompoundCommand is empty

redo

public void redo()
Description copied from class: Command
Re-executes the Command. This method should only be called after undo() has been called.

Overrides:
redo in class Command
See Also:
Command.redo()

size

public int size()
Returns:
the number of contained Commands

undo

public void undo()
Description copied from class: Command
Undoes the changes performed during execute(). This method should only be called after execute has been called, and only when canUndo() returns true.

Overrides:
undo in class Command
See Also:
Command.undo()

unwrap

public 
Command unwrap()
Returns the simplest form of this Command that is equivalent. This is useful for removing unnecessary nesting of Commands.

Returns:
the simplest form of this Command that is equivalent

Eclipse GEF
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire