|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(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(Command command,
Map<?,?> options)
Implemented by subclasses to perform the execution of the specified command . |
void |
executeTriggers(Command command,
List<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 Command s. |
protected String |
getDefaultUndoContextLabel()
Obtains the label to display for the default undo context that I apply to operations executed through me as Command s. |
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. |
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). |
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 historyMethod Detail |
---|
public void setEditingDomain(InternalTransactionalEditingDomain domain)
setEditingDomain
in interface InternalTransactionalCommandStack
setEditingDomain
in class AbstractTransactionalCommandStack
domain
- my editing domainInternalTransactionalCommandStack.createTransaction(Command, Map)
public final IOperationHistory getOperationHistory()
IWorkspaceCommandStack
getOperationHistory
in interface IWorkspaceCommandStack
public final IUndoContext getDefaultUndoContext()
IWorkspaceCommandStack
Command
s. 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 IWorkspaceCommandStack
TransactionalCommandStack.execute(Command, java.util.Map)
,
CommandStack.undo()
,
CommandStack.redo()
,
CommandStack.flush()
,
CommandStack.getMostRecentCommand()
,
CommandStack.getUndoCommand()
,
CommandStack.getRedoCommand()
protected String getDefaultUndoContextLabel()
Command
s. Subclasses may
override to customize the label.
protected String getSavepointUndoContextLabel()
saveIsDone()
method). Subclasses may override to customize the label.
protected void doExecute(Command command, Map<?,?> options) throws InterruptedException, RollbackException
command
. Invoked by the AbstractTransactionalCommandStack.execute(Command, Map)
method.
doExecute
in class AbstractTransactionalCommandStack
command
- 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 CommandStack
canUndo
in class BasicCommandStack
public void undo()
undo
in interface CommandStack
undo
in class BasicCommandStack
public boolean canRedo()
canRedo
in interface CommandStack
canRedo
in class BasicCommandStack
public void redo()
redo
in interface CommandStack
redo
in class BasicCommandStack
public void flush()
flush
in interface CommandStack
flush
in class BasicCommandStack
public Command getMostRecentCommand()
getMostRecentCommand
in interface CommandStack
getMostRecentCommand
in class BasicCommandStack
public Command getUndoCommand()
getUndoCommand
in interface CommandStack
getUndoCommand
in class BasicCommandStack
public Command getRedoCommand()
getRedoCommand
in interface CommandStack
getRedoCommand
in class BasicCommandStack
public EMFCommandTransaction createTransaction(Command command, Map<?,?> options) throws InterruptedException
InternalTransactionalCommandStack
createTransaction
in interface InternalTransactionalCommandStack
command
- 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(Command command, List<Command> triggers, Map<?,?> options) throws InterruptedException, RollbackException
InternalTransactionalCommandStack
command
; they must not be "piggy-backed" on
the currently active transaction.
executeTriggers
in interface InternalTransactionalCommandStack
command
- the command whose execution triggered additional commands
(from pre-commit listeners)triggers
- a list of zero or more Command
s 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()
InternalTransactionalCommandStack
editing domain
is disposed.
dispose
in interface InternalTransactionalCommandStack
public IResourceUndoContextPolicy getResourceUndoContextPolicy()
public void setResourceUndoContextPolicy(IResourceUndoContextPolicy policy)
policy
- my new policy, or null
to restore the defaultpublic boolean isSaveNeeded()
isSaveNeeded
in class BasicCommandStack
public void saveIsDone()
saveIsDone
in class 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 |