As a second part of the transaction framework there is a support layer for using the TransactionalEditingDomain
in the context of an eclipse IOperationHistory
. This support layer can be found in the org.eclipse.emf.workspace
plugin and has the following main classes that can be used by clients:
-
The
WorkspaceEditingDomainFactory
can be used to create a new transactional editing domain
that delegates it command execution, undo and redo to an IOperationHistory
that is either provided
by the client or retrieved from the OperationHistoryFactory
. Any EMF-style commands executed
on this special transactional editing domain's command stack will be wrapped and executed on the operation history.
-
All
IOperation
s that will be making changes to a workspace transactional editing domain
can subclass the AbstractEMFOperation
class in order to obtain the necessary write lock.
Note that undo and redo is handled automatically because the changes made during the operation's execution
are recorded. The CompositeEMFOperation
allows clients to compose operations that change
their editing domain and those that make changes to non-EMF objects. Client must not
make changes to non-EMF objects within an AbstractEMFOperation because undo/redo is expected to
be handled automatically by recording changes to EMF objects.
-
Clients can determine if an operation affects their EMF resource(s) by
calling
ResourceUndoContext.getAffectedResources()
. This is particularly useful for
IOperationHistoryListener
s to determine whether or not a completed operation
should be tagged with their own IUndoContext
to signal that this operation should
show up on their undo/redo menus.
-
A
WorkspaceSynchronizer
is provided to help clients keep their editing domains
synchronized with changes that are being made to files in the eclipse workspace.
Please refer to the tutorial
Workspace Integration Tutorial.
Copyright (c) 2006 IBM Corporation and others. All Rights Reserved.