|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.emf.common.command.BasicCommandStack
org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack
org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl
public class WorkspaceCommandStackImpl
Implementation of a transactional command stack that delegates
execution of commands to an IOperationHistory.
This is the command stack implementation used by editing domains created by
the WorkspaceEditingDomainFactory.
| Field Summary |
|---|
| Fields inherited from class org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack |
|---|
exceptionHandler |
| Fields inherited from class org.eclipse.emf.common.command.BasicCommandStack |
|---|
commandList, listeners, mostRecentCommand, saveIndex, top |
| Constructor Summary | |
|---|---|
WorkspaceCommandStackImpl(IOperationHistory history)
Initializes me with the operation history to which I delegate command execution. |
|
| Method Summary | |
|---|---|
boolean |
canRedo()
Queries whether we can redo my default undo context in my operation history. |
boolean |
canUndo()
Queries whether we can undo my default undo context in my operation history. |
EMFCommandTransaction |
createTransaction(org.eclipse.emf.common.command.Command command,
Map<?,?> options)
Creates a read/write transaction in my editing domain for the purpose of executing the specified command. |
void |
dispose()
Disposes of my state and any additional resources that I may be retaining. |
protected void |
doExecute(org.eclipse.emf.common.command.Command command,
Map<?,?> options)
Implemented by subclasses to perform the execution of the specified command. |
void |
executeTriggers(org.eclipse.emf.common.command.Command command,
List<org.eclipse.emf.common.command.Command> triggers,
Map<?,?> options)
Executes the specified list of trigger commands. |
void |
flush()
Disposes my default undo context in my operation history. |
IUndoContext |
getDefaultUndoContext()
Obtains the default undo context to add to the undoable operations that I execute on my operation history to wrap Commands. |
protected String |
getDefaultUndoContextLabel()
Obtains the label to display for the default undo context that I apply to operations executed through me as Commands. |
org.eclipse.emf.common.command.Command |
getMostRecentCommand()
Gets the command from the most recently executed, done, or redone operation. |
IOperationHistory |
getOperationHistory()
Obtains the operation history to which I delegate command execution. |
org.eclipse.emf.common.command.Command |
getRedoCommand()
Gets the command from the top of the redo history, if any. |
IResourceUndoContextPolicy |
getResourceUndoContextPolicy()
Obtains my resource undo-context policy. |
protected String |
getSavepointUndoContextLabel()
Obtains the label to display for the save-point undo context that I apply to the last operation in my default undo context that was executed at the time save was performed (as indicated by invocation of the saveIsDone() method). |
org.eclipse.emf.common.command.Command |
getUndoCommand()
Gets the command from the top of the undo history, if any. |
boolean |
isSaveNeeded()
|
void |
redo()
Redoes my default undo context in my operation history. |
void |
saveIsDone()
|
void |
setEditingDomain(InternalTransactionalEditingDomain domain)
Extends the superclass implementation to add/remove listeners on the editing domain. |
void |
setResourceUndoContextPolicy(IResourceUndoContextPolicy policy)
Sets my resource undo-context policy. |
void |
undo()
Undoes my default undo context in my operation history. |
| Methods inherited from class org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack |
|---|
basicExecute, execute, execute, getDomain, getExceptionHandler, getUndoRedoOptions, handleError, handleRollback, makeTriggerTransactionOptions, rollback, setExceptionHandler |
| Methods inherited from class org.eclipse.emf.common.command.BasicCommandStack |
|---|
addCommandStackListener, notifyListeners, removeCommandStackListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.emf.transaction.TransactionalCommandStack |
|---|
execute, getExceptionHandler, setExceptionHandler |
| Methods inherited from interface org.eclipse.emf.common.command.CommandStack |
|---|
addCommandStackListener, execute, removeCommandStackListener |
| Constructor Detail |
|---|
public WorkspaceCommandStackImpl(IOperationHistory history)
history - my operation history| Method Detail |
|---|
public void setEditingDomain(InternalTransactionalEditingDomain domain)
setEditingDomain in interface InternalTransactionalCommandStacksetEditingDomain in class AbstractTransactionalCommandStackdomain - my editing domainInternalTransactionalCommandStack.createTransaction(Command, Map)public final IOperationHistory getOperationHistory()
IWorkspaceCommandStack
getOperationHistory in interface IWorkspaceCommandStackpublic final IUndoContext getDefaultUndoContext()
IWorkspaceCommandStackCommands. Moreover,
undo, redo, and flush are context-specific operations
in the operation history, so my undo/redo/flush commands use this context
in delegating to the history. Likewise, the determination of the
most recent command and undo/redo commands depends on this context.
getDefaultUndoContext in interface IWorkspaceCommandStackTransactionalCommandStack.execute(Command, java.util.Map),
CommandStack.undo(),
CommandStack.redo(),
CommandStack.flush(),
CommandStack.getMostRecentCommand(),
CommandStack.getUndoCommand(),
CommandStack.getRedoCommand()protected String getDefaultUndoContextLabel()
Commands. Subclasses may
override to customize the label.
protected String getSavepointUndoContextLabel()
saveIsDone() method). Subclasses may override to customize the label.
protected void doExecute(org.eclipse.emf.common.command.Command command,
Map<?,?> options)
throws InterruptedException,
RollbackException
command. Invoked by the AbstractTransactionalCommandStack.execute(Command, Map)
method.
doExecute in class AbstractTransactionalCommandStackcommand - the command to executeoptions - the transaction options to apply to execution of the command
InterruptedException - if the current thread is interrupted while
waiting to start the transaction
RollbackException - if the execution of the command is rolled backpublic boolean canUndo()
canUndo in interface org.eclipse.emf.common.command.CommandStackcanUndo in class org.eclipse.emf.common.command.BasicCommandStackpublic void undo()
undo in interface org.eclipse.emf.common.command.CommandStackundo in class org.eclipse.emf.common.command.BasicCommandStackpublic boolean canRedo()
canRedo in interface org.eclipse.emf.common.command.CommandStackcanRedo in class org.eclipse.emf.common.command.BasicCommandStackpublic void redo()
redo in interface org.eclipse.emf.common.command.CommandStackredo in class org.eclipse.emf.common.command.BasicCommandStackpublic void flush()
flush in interface org.eclipse.emf.common.command.CommandStackflush in class org.eclipse.emf.common.command.BasicCommandStackpublic org.eclipse.emf.common.command.Command getMostRecentCommand()
getMostRecentCommand in interface org.eclipse.emf.common.command.CommandStackgetMostRecentCommand in class org.eclipse.emf.common.command.BasicCommandStackpublic org.eclipse.emf.common.command.Command getUndoCommand()
getUndoCommand in interface org.eclipse.emf.common.command.CommandStackgetUndoCommand in class org.eclipse.emf.common.command.BasicCommandStackpublic org.eclipse.emf.common.command.Command getRedoCommand()
getRedoCommand in interface org.eclipse.emf.common.command.CommandStackgetRedoCommand in class org.eclipse.emf.common.command.BasicCommandStack
public EMFCommandTransaction createTransaction(org.eclipse.emf.common.command.Command command,
Map<?,?> options)
throws InterruptedException
InternalTransactionalCommandStack
createTransaction in interface InternalTransactionalCommandStackcommand - a command that I need to executeoptions - the options to apply to the resulting transaction
InterruptedException - if the current thread is interrupted while
waiting for the transaction to startInternalTransactionalCommandStack.getDomain()
public void executeTriggers(org.eclipse.emf.common.command.Command command,
List<org.eclipse.emf.common.command.Command> triggers,
Map<?,?> options)
throws InterruptedException,
RollbackException
InternalTransactionalCommandStackcommand; they must not be "piggy-backed" on
the currently active transaction.
executeTriggers in interface InternalTransactionalCommandStackcommand - the command whose execution triggered additional commands
(from pre-commit listeners)triggers - a list of zero or more Commands to execute.
If there are none, then no transaction needs to be startedoptions - the options to apply to the child transaction
InterruptedException - if the current thread is interrupted while
waiting for the trigger transaction to start
RollbackException - if the trigger transaction rolls back on commitResourceSetListener.transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent),
InternalTransactionalCommandStack.createTransaction(Command, Map)public void dispose()
InternalTransactionalCommandStackediting domain
is disposed.
dispose in interface InternalTransactionalCommandStackpublic IResourceUndoContextPolicy getResourceUndoContextPolicy()
public void setResourceUndoContextPolicy(IResourceUndoContextPolicy policy)
policy - my new policy, or null to restore the defaultpublic boolean isSaveNeeded()
isSaveNeeded in class org.eclipse.emf.common.command.BasicCommandStackpublic void saveIsDone()
saveIsDone in class org.eclipse.emf.common.command.BasicCommandStack
|
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 | |||||||||