|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.common.command.AbstractCommand org.eclipse.emf.edit.command.ChangeCommand
public abstract class ChangeCommand
This command uses the Change Model facilities to enable a group of modifications to be executed as one single command. The undo operation reverts all the modifications made when the command was executed
In order to use this class, the org.eclipse.emf.ecore.change plugin has to be available in your Eclipse configuration.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
AbstractCommand.NonDirtying |
Field Summary | |
---|---|
protected ChangeDescription |
changeDescription
|
protected ChangeRecorder |
changeRecorder
|
protected Notifier |
notifier
|
protected java.util.Collection<Notifier> |
notifiers
|
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
description, isExecutable, isPrepared, label |
Constructor Summary | |
---|---|
protected |
ChangeCommand(ChangeRecorder changeRecorder)
|
|
ChangeCommand(ChangeRecorder changeRecorder,
java.util.Collection<Notifier> notifiers)
|
|
ChangeCommand(ChangeRecorder changeRecorder,
Notifier notifier)
|
|
ChangeCommand(java.util.Collection<Notifier> notifiers)
|
|
ChangeCommand(Notifier notifier)
|
Method Summary | |
---|---|
protected ChangeRecorder |
createChangeRecorder()
|
void |
dispose()
Called to indicate that the command will never be used again. |
protected void |
disposeChangeRecorder(ChangeRecorder changeRecorder)
Disposes the ChangeRecorder created by execute() . |
protected abstract void |
doExecute()
Subclasses should override this to perform modifications to resources and objects. |
void |
execute()
Executes the command. |
protected ChangeDescription |
getChangeDescription()
|
ChangeRecorder |
getChangeRecorder()
Returns the ChangeRecorder specified in the
constructor if any. |
protected boolean |
prepare()
Called at most once in AbstractCommand.canExecute() to give the command an opportunity to ready itself for execution. |
void |
redo()
Performs the command activity required to redo the effect after undoing the effect. |
protected void |
setChangeDescription(ChangeDescription changeDescription)
|
void |
undo()
Throws a runtime exception. |
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand |
---|
canExecute, canUndo, chain, getAffectedObjects, getDescription, getLabel, getResult, setDescription, setLabel, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ChangeDescription changeDescription
protected Notifier notifier
protected java.util.Collection<Notifier> notifiers
protected ChangeRecorder changeRecorder
Constructor Detail |
---|
protected ChangeCommand(ChangeRecorder changeRecorder)
public ChangeCommand(ChangeRecorder changeRecorder, Notifier notifier)
public ChangeCommand(Notifier notifier)
public ChangeCommand(ChangeRecorder changeRecorder, java.util.Collection<Notifier> notifiers)
public ChangeCommand(java.util.Collection<Notifier> notifiers)
Method Detail |
---|
public void dispose()
Command
dispose
in interface Command
dispose
in class AbstractCommand
public ChangeRecorder getChangeRecorder()
ChangeRecorder
specified in the
constructor if any.
ChangeRecorder
protected ChangeRecorder createChangeRecorder()
protected ChangeDescription getChangeDescription()
protected void setChangeDescription(ChangeDescription changeDescription)
protected boolean prepare()
AbstractCommand
AbstractCommand.canExecute()
to give the command an opportunity to ready itself for execution.
The returned value is stored in AbstractCommand.canExecute()
.
In other words, you can override this method to initialize
and to yield a cached value for the all subsequent calls to canExecute.
prepare
in class AbstractCommand
public void execute()
doExecute()
.
protected abstract void doExecute()
AbortExecutionException
may be thrown to avoid placing the command on the command stack.
protected void disposeChangeRecorder(ChangeRecorder changeRecorder)
ChangeRecorder
created by execute()
. The default
implementation doesn't dispose the change recorder if it was passed in
through one of the constructor methods.
changeRecorder
- public void undo()
AbstractCommand
undo
in interface Command
undo
in class AbstractCommand
public void redo()
Command
redo
the effect after undoing the effect.
The effect, if any, of calling redo
before undo
is called is undefined.
Note that if you implement redo
to call execute
then any derived class will be restricted by that decision also.
|
Copyright 2001-2012 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |