|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.transaction.util.TransactionUtil
public class TransactionUtil
Static utilities for dealing with EMF elements and resources in a transactional editing domain.
Method Summary | ||
---|---|---|
static
|
createPrivilegedRunnable(TransactionalEditingDomain domain,
RunnableWithResult<? extends T> runnable)
Utility method for providing privileged access to runnables that return values. |
|
static void |
disconnectFromEditingDomain(EObject eobject)
Disconnects the specified element from its editing domain, so that it is released from the constraints of the transactional environment. |
|
static void |
disconnectFromEditingDomain(Resource resource)
Disconnects the specified resource from its editing domain, so that it is released from the constraints of the transactional environment. |
|
static void |
dispose(ChangeDescription change)
Disposes a change description. |
|
static
|
getAdapter(TransactionalEditingDomain domain,
Class<? extends T> adapterType)
Obtains an instance of the specified adapter type for an editing domain. |
|
static TransactionalEditingDomain |
getEditingDomain(EObject eObject)
Obtains the transactional editing domain that manages the specified element. |
|
static TransactionalEditingDomain |
getEditingDomain(Object object)
Obtains the transactional editing domain that manages the specified object. |
|
static TransactionalEditingDomain |
getEditingDomain(Resource resource)
Obtains the transactional editing domain that manages the specified resource. |
|
static TransactionalEditingDomain |
getEditingDomain(ResourceSet rset)
Obtains the transactional editing domain that manages the specified resource set. |
|
static Transaction.OptionMetadata.Registry |
getTransactionOptionRegistry(TransactionalEditingDomain domain)
Gets the best transaction-option registry available for the specified editing domain. |
|
static
|
runExclusive(TransactionalEditingDomain domain,
RunnableWithResult<? extends T> runnable)
Utility method for executing exclusive runnables that return values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static TransactionalEditingDomain getEditingDomain(EObject eObject)
eObject
- an EMF model element
null
if it is not attached
to any resource in an editing domainpublic static TransactionalEditingDomain getEditingDomain(Resource resource)
resource
- a resource
null
if it is not in a
resource set managed by an editing domainpublic static TransactionalEditingDomain getEditingDomain(ResourceSet rset)
rset
- a resource set
null
if it is managed by
an editing domainpublic static TransactionalEditingDomain getEditingDomain(Object object)
Notification
originated by
testing its
notifier
.
object
- some object
null
if it is not of a type
that is managed by an editing domain or if it is of an appropriate
type but happens not to be managed by an editing domainpublic static void disconnectFromEditingDomain(Resource resource)
Disconnects the specified resource from its editing domain, so that it is released from the constraints of the transactional environment. Note that this is only permitted if the resource is not currently attached to the resource set of the editing domain in question.
This should only be done with extreme caution. If any other resources that are still being managed by the transactional editing domain have dependencies on this resource, then existing undo/redo information for these may be corrupted and future undo recording may not be complete. It is highly recommended to flush the command stack of the editing domain in question after disconnecting a resource from it.
resource
- a resource to disconnect from its current editing domain,
if any
IllegalStateException
- if the specified resource is
still in the ResourceSet
managed by its current editing
domainpublic static void disconnectFromEditingDomain(EObject eobject)
Disconnects the specified element from its editing domain, so that it is released from the constraints of the transactional environment. Note that this is only permitted if the element is not currently attached to the resource set of the editing domain in question.
This should only be done with extreme caution. If any other elements that are still being managed by the transactional editing domain have dependencies on this eobject, then existing undo/redo information for these may be corrupted and future undo recording may not be complete. It is highly recommended to flush the command stack of the editing domain in question after disconnecting an element from it.
It is probably more useful to
disconnect an entire
Resource
from the editing domain instead of just an object,
unless that object is being moved from one editing domain to another.
eobject
- a model element to disconnect from its current editing
domain, if any
IllegalStateException
- if the specified eobject is
still in the ResourceSet
managed by its current editing
domaindisconnectFromEditingDomain(Resource)i
public static void dispose(ChangeDescription change)
change
- a change description to disposepublic static <T> T getAdapter(TransactionalEditingDomain domain, Class<? extends T> adapterType)
T
- the adapter interface that is requireddomain
- an editing domain to adaptadapterType
- the required interface
null
if it does not supply this interfacepublic static <T> T runExclusive(TransactionalEditingDomain domain, RunnableWithResult<? extends T> runnable) throws InterruptedException
TransactionalEditingDomain.runExclusive(Runnable)
is
that it provides compile-time type safety.
T
- the result type of the runnabledomain
- the editing domain in which to runrunnable
- the runnable to execute
InterruptedException
- if the current thread is interrupted while
waiting for access to the resource setpublic static <T> RunnableWithResult<T> createPrivilegedRunnable(TransactionalEditingDomain domain, RunnableWithResult<? extends T> runnable) throws InterruptedException
TransactionalEditingDomain.createPrivilegedRunnable(Runnable)
is
that it provides compile-time type safety.
T
- the result type of the runnabledomain
- the editing domain in which to grant privileged accessrunnable
- the runnable to execute
InterruptedException
- if the current thread is interrupted while
waiting for access to the resource setpublic static Transaction.OptionMetadata.Registry getTransactionOptionRegistry(TransactionalEditingDomain domain)
domain
- an editing domain
null
|
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 |