|
||||||||||
| 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.transaction.RecordingCommand
public abstract class RecordingCommand
A partial Command implementation that
records the changes made by a subclass's direct manipulation of objects via
the metamodel's API. This simplifies the programming model for complex
commands (not requiring composition of set/add/remove commands) while
still providing automatic undo/redo support.
Subclasses are simply required to implement the doExecute() method
to make the desired changes to the model. Note that, because changes are
recorded for automatic undo/redo, the concrete command must not make any
changes that cannot be recorded by EMF (unless it does not matter that they
will not be undone).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand |
|---|
org.eclipse.emf.common.command.AbstractCommand.NonDirtying |
| Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.util.ConditionalRedoCommand |
|---|
ConditionalRedoCommand.Compound |
| Field Summary |
|---|
| Fields inherited from class org.eclipse.emf.common.command.AbstractCommand |
|---|
description, isExecutable, isPrepared, label |
| Constructor Summary | |
|---|---|
RecordingCommand(TransactionalEditingDomain domain)
Initializes me with the editing domain in which I am to be executed. |
|
RecordingCommand(TransactionalEditingDomain domain,
String label)
Initializes me with my editing domain and a human-readable label. |
|
RecordingCommand(TransactionalEditingDomain domain,
String label,
String description)
Initializes me with my editing domain, label, and more expansive description. |
|
| Method Summary | |
|---|---|
boolean |
canRedo()
I can be redone if I successfully recorded the changes that I executed. |
boolean |
canUndo()
I can be undone if I successfully recorded the changes that I executed. |
org.eclipse.emf.common.command.Command |
chain(org.eclipse.emf.common.command.Command command)
|
void |
dispose()
Extends the inherited implementation by disposing my change description, if any. |
protected abstract void |
doExecute()
Implemented by subclasses to perform the necessary changes in the model. |
void |
execute()
Implements the execution with automatic recording of undo information. |
protected void |
postExecute()
Will be called after doExecute(). |
protected void |
preExecute()
Will be called prior to doExecute(). |
protected boolean |
prepare()
Subclasses should override this if they have more preparation to do. |
void |
redo()
Redoes the changes that I recorded. |
void |
undo()
Undoes the changes that I recorded. |
| Methods inherited from class org.eclipse.emf.common.command.AbstractCommand |
|---|
canExecute, getAffectedObjects, getDescription, getLabel, getResult, setDescription, setLabel, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.eclipse.emf.common.command.Command |
|---|
canExecute, getAffectedObjects, getDescription, getLabel, getResult |
| Constructor Detail |
|---|
public RecordingCommand(TransactionalEditingDomain domain)
domain - my domain
public RecordingCommand(TransactionalEditingDomain domain,
String label)
domain - my domainlabel - my user-friendly label
public RecordingCommand(TransactionalEditingDomain domain,
String label,
String description)
domain - my domainlabel - my labeldescription - my long description| Method Detail |
|---|
protected boolean prepare()
true.
prepare in class org.eclipse.emf.common.command.AbstractCommandpublic final void execute()
doExecute() method.
execute in interface org.eclipse.emf.common.command.CommanddoExecute()protected void preExecute()
doExecute().
protected void postExecute()
doExecute().
public boolean canUndo()
canUndo in interface org.eclipse.emf.common.command.CommandcanUndo in class org.eclipse.emf.common.command.AbstractCommandpublic boolean canRedo()
canRedo in interface ConditionalRedoCommandtrue if I can be redone; false,
otherwisepublic final void undo()
undo in interface org.eclipse.emf.common.command.Commandundo in class org.eclipse.emf.common.command.AbstractCommandIllegalStateException - if I am not undoablecanUndo()public final void redo()
redo in interface org.eclipse.emf.common.command.CommandIllegalStateException - if I am not redoablecanRedo()protected abstract void doExecute()
public org.eclipse.emf.common.command.Command chain(org.eclipse.emf.common.command.Command command)
chain in interface org.eclipse.emf.common.command.Commandchain in class org.eclipse.emf.common.command.AbstractCommandpublic void dispose()
dispose in interface org.eclipse.emf.common.command.Commanddispose in class org.eclipse.emf.common.command.AbstractCommand
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||