|
||||||||||
| 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
public abstract class AbstractTransactionalCommandStack
Partial implementation of the TransactionalCommandStack interface,
useful for subclasses to define their specific handling of transactions and
other concerns.
| Field Summary | |
|---|---|
protected ExceptionHandler |
exceptionHandler
|
| Fields inherited from class org.eclipse.emf.common.command.BasicCommandStack |
|---|
commandList, listeners, mostRecentCommand, saveIndex, top |
| Constructor Summary | |
|---|---|
AbstractTransactionalCommandStack()
Initializes me. |
|
| Method Summary | |
|---|---|
protected void |
basicExecute(Command command)
Provides access to the BasicCommandStack implementation of the
execute(Command) method, as this class overrides it to delegate
to the TransactionalCommandStack.execute(Command, Map) method. |
protected abstract void |
doExecute(Command command,
Map<?,?> options)
Implemented by subclasses to perform the execution of the specified command. |
void |
execute(Command command)
Redefines the inherited method by forwarding to the TransactionalCommandStack.execute(Command, Map) method. |
void |
execute(Command command,
Map<?,?> options)
Default implementation delegates to the subclass implementation of doExecute(Command, Map), handling the roll-back exception if the
command is rolled back. |
InternalTransactionalEditingDomain |
getDomain()
Obtains the editing domain in which I create transactions. |
ExceptionHandler |
getExceptionHandler()
Obtains my exception handler. |
protected Map<?,?> |
getUndoRedoOptions()
Obtains my editing domain's default undo/redo transaction options. |
protected void |
handleError(Exception exception)
Extends the inherited method by first aborting the active transaction (if any) and passing the exception along to the registered exception handler (if any). |
protected void |
handleRollback(Command command,
RollbackException rbe)
Handles the roll-back of the specified command execution. |
static Map<Object,Object> |
makeTriggerTransactionOptions(Map<?,?> options)
Customizes the specified options for the case of a transaction
that executes trigger commands. |
protected void |
rollback(Transaction tx)
Ensures that the specified transaction is rolled back, first rolling back a nested transaction (if any). |
void |
setEditingDomain(InternalTransactionalEditingDomain domain)
Assigns the editing domain in which I create transactions. |
void |
setExceptionHandler(ExceptionHandler handler)
Sets an exception handler. |
| Methods inherited from class org.eclipse.emf.common.command.BasicCommandStack |
|---|
addCommandStackListener, canRedo, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, isSaveNeeded, notifyListeners, redo, removeCommandStackListener, saveIsDone, undo |
| 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.impl.InternalTransactionalCommandStack |
|---|
createTransaction, dispose, executeTriggers |
| Methods inherited from interface org.eclipse.emf.common.command.CommandStack |
|---|
addCommandStackListener, canRedo, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, redo, removeCommandStackListener, undo |
| Field Detail |
|---|
protected ExceptionHandler exceptionHandler
| Constructor Detail |
|---|
public AbstractTransactionalCommandStack()
| Method Detail |
|---|
public InternalTransactionalEditingDomain getDomain()
InternalTransactionalCommandStack
getDomain in interface InternalTransactionalCommandStackInternalTransactionalCommandStack.createTransaction(Command, Map)public void setEditingDomain(InternalTransactionalEditingDomain domain)
InternalTransactionalCommandStack
setEditingDomain in interface InternalTransactionalCommandStackdomain - my editing domainInternalTransactionalCommandStack.createTransaction(Command, Map)protected void rollback(Transaction tx)
tx - a transaction to roll backpublic void setExceptionHandler(ExceptionHandler handler)
TransactionalCommandStack
setExceptionHandler in interface TransactionalCommandStackhandler - the exception handler to setpublic ExceptionHandler getExceptionHandler()
TransactionalCommandStack
getExceptionHandler in interface TransactionalCommandStacknull if noneTransactionalCommandStack.setExceptionHandler(ExceptionHandler)protected void handleError(Exception exception)
handleError in class BasicCommandStack
public void execute(Command command,
Map<?,?> options)
throws InterruptedException,
RollbackException
doExecute(Command, Map), handling the roll-back exception if the
command is rolled back. Note that doExecute() is only
called if the command is executable.
execute in interface TransactionalCommandStackcommand - the command to executeoptions - the options to apply to the command's transaction, or
null to select the defaults
InterruptedException - if the current thread is interrupted while
waiting to start a read/write transaction for the command execution
RollbackException - if the changes performed by the command are
rolled back by validation of the transaction
protected abstract void doExecute(Command command,
Map<?,?> options)
throws InterruptedException,
RollbackException
command. Invoked by the execute(Command, Map)
method.
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 back
protected void handleRollback(Command command,
RollbackException rbe)
command execution.
This default implementation disposes the command and notifies
command-stack listeners so that they may get the latest information, in
case they were already notified of command execution, for example.
command - the command whose execution was rolled back (may be
null if not known)rbe - the roll-back exception (may be null if no
exception is to be thrown)public void execute(Command command)
TransactionalCommandStack.execute(Command, Map) method. Any
checked exception thrown by that method is handled by
handleError(Exception) but is not propagated.
execute in interface CommandStackexecute in class BasicCommandStackprotected void basicExecute(Command command)
BasicCommandStack implementation of the
execute(Command) method, as this class overrides it to delegate
to the TransactionalCommandStack.execute(Command, Map) method.
command - the command to executeprotected Map<?,?> getUndoRedoOptions()
public static final Map<Object,Object> makeTriggerTransactionOptions(Map<?,?> options)
options for the case of a transaction
that executes trigger commands. The original map is not affected.
options - a client-supplied options map
|
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 | |||||||||