|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.common.command.CompoundCommand
org.eclipse.emf.common.command.StrictCompoundCommand
org.eclipse.emf.edit.command.CopyCommand
public class CopyCommand
The copy command logically acts upon an owner object or collection or owner objects
and copies the tree structured implied by the MOF containment hierarchy.
The static create methods delegate command creation to EditingDomain.createCommand
.
The copy implementation is, at each level, delegated to CreateCopyCommand
and
InitializeCopyCommand
which can be overridden to control the copy's object creation
and initialization respectively.
Nested Class Summary | |
---|---|
static class |
CopyCommand.Helper
This helper class is used to keep track of copied objects and their associated copies. |
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
AbstractCommand.NonDirtying |
Field Summary | |
---|---|
protected CopyCommand.Helper |
copyHelper
This is a map of objects to their copies |
protected static java.lang.String |
DESCRIPTION
This caches the description. |
protected EditingDomain |
domain
This keeps track of the domain in which this command is created. |
protected static java.lang.String |
LABEL
This caches the label. |
protected boolean |
optimize
This controls whether or not to optimize the canExecute (prepare) |
protected EObject |
owner
This keeps track of the owner in the command parameter from the constructor. |
Fields inherited from class org.eclipse.emf.common.command.StrictCompoundCommand |
---|
isPessimistic, isUndoable, rightMostExecutedCommandIndex |
Fields inherited from class org.eclipse.emf.common.command.CompoundCommand |
---|
commandList, LAST_COMMAND_ALL, MERGE_COMMAND_ALL, resultIndex |
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
description, isExecutable, isPrepared, label |
Constructor Summary | |
---|---|
CopyCommand(EditingDomain domain,
EObject owner,
CopyCommand.Helper copyHelper)
This creates and instance in the given domain and for the given owner |
|
CopyCommand(EditingDomain domain,
EObject owner,
CopyCommand.Helper copyHelper,
boolean optimize)
This creates and instance in the given domain and for the given owner |
Method Summary | |
---|---|
protected void |
addCreateCopyCommands(CompoundCommand compoundCommand,
EObject object)
|
boolean |
canExecute()
Calls AbstractCommand.prepare() ,
caches the result in AbstractCommand.isExecutable ,
and sets AbstractCommand.isPrepared to true ;
from then on, it will yield the value of isExecutable. |
static Command |
create(EditingDomain domain,
java.util.Collection<?> collection)
This creates a command that copies the given collection of objects. |
static Command |
create(EditingDomain domain,
java.lang.Object owner)
This creates a command that copies the given object. |
void |
execute()
Calls Command.execute() for each command in the list,
but makes sure to call redo for any commands that were previously executed to compute canExecute. |
protected boolean |
prepare()
Returns false if any command on the list returns false for Command.canExecute() ,
or if some command before the last one can't be undone and hence we can't test all the commands for executability. |
java.lang.String |
toString()
This gives an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of field:value pairs. |
Methods inherited from class org.eclipse.emf.common.command.StrictCompoundCommand |
---|
appendAndExecute, redo, undo |
Methods inherited from class org.eclipse.emf.common.command.CompoundCommand |
---|
append, appendIfCanExecute, canUndo, dispose, getAffectedObjects, getCommandList, getDescription, getLabel, getMergedAffectedObjectsCollection, getMergedResultCollection, getResult, getResultIndex, isEmpty, unwrap |
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
chain, setDescription, setLabel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String LABEL
protected static final java.lang.String DESCRIPTION
protected EditingDomain domain
protected EObject owner
protected CopyCommand.Helper copyHelper
protected boolean optimize
Constructor Detail |
---|
public CopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper copyHelper)
public CopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper copyHelper, boolean optimize)
Method Detail |
---|
public static Command create(EditingDomain domain, java.lang.Object owner)
public static Command create(EditingDomain domain, java.util.Collection<?> collection)
protected boolean prepare()
StrictCompoundCommand
false
if any command on the list returns false
for Command.canExecute()
,
or if some command before the last one can't be undone and hence we can't test all the commands for executability.
prepare
in class StrictCompoundCommand
public boolean canExecute()
AbstractCommand
AbstractCommand.prepare()
,
caches the result in AbstractCommand.isExecutable
,
and sets AbstractCommand.isPrepared
to true
;
from then on, it will yield the value of isExecutable.
canExecute
in interface Command
canExecute
in class AbstractCommand
public void execute()
StrictCompoundCommand
Command.execute()
for each command in the list,
but makes sure to call redo for any commands that were previously executed to compute canExecute.
In the case that StrictCompoundCommand.isPessimistic
is false, only the last command will be executed
since the others will have been executed but not undone during StrictCompoundCommand.prepare()
.
execute
in interface Command
execute
in class StrictCompoundCommand
protected void addCreateCopyCommands(CompoundCommand compoundCommand, EObject object)
public java.lang.String toString()
toString
in class StrictCompoundCommand
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |