org.eclipse.emf.transaction.ui.provider
Class TransactionalAdapterFactoryContentProvider

java.lang.Object
  extended by org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider
      extended by org.eclipse.emf.transaction.ui.provider.TransactionalAdapterFactoryContentProvider
All Implemented Interfaces:
INotifyChangedListener, IContentProvider, IStructuredContentProvider, ITreeContentProvider, IPropertySourceProvider

public class TransactionalAdapterFactoryContentProvider
extends AdapterFactoryContentProvider

Automatically wraps any potential access to model objects in read transactions. Note that this is not necessary in the case of the AdapterFactoryContentProvider.notifyChanged(Notification) method because this will always be called in a transaction context.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider
AdapterFactoryContentProvider.ViewerRefresh
 
Field Summary
 
Fields inherited from class org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider
adapterFactory, viewer, viewerRefresh
 
Constructor Summary
TransactionalAdapterFactoryContentProvider(TransactionalEditingDomain domain, AdapterFactory adapterFactory)
          Initializes me with the editing domain in which I create read transactions and that adapter factory that provides content providers.
 
Method Summary
protected  IPropertySource createPropertySource(Object object, IItemPropertySource itemPropertySource)
          Extends the inherited implementation by running in a read-only transaction.
 Object[] getChildren(Object object)
          Extends the inherited implementation by running in a read-only transaction.
 Object[] getElements(Object object)
          Extends the inherited implementation by running in a read-only transaction.
 Object getParent(Object object)
          Extends the inherited implementation by running in a read-only transaction.
 IPropertySource getPropertySource(Object object)
          Extends the inherited implementation by running in a read-only transaction.
 boolean hasChildren(Object object)
          Extends the inherited implementation by running in a read-only transaction.
 void inputChanged(Viewer vwr, Object oldInput, Object newInput)
          Extends the inherited implementation by running in a read-only transaction.
protected
<T> T
run(RunnableWithResult<? extends T> run)
          Runs the specified runnable in the editing domain, with interrupt handling.
protected  IPropertySource wrap(IPropertySource propertySource)
          Wraps a property source in a transactional property source.
 
Methods inherited from class org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider
dispose, getAdapterFactory, notifyChanged, setAdapterFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionalAdapterFactoryContentProvider

public TransactionalAdapterFactoryContentProvider(TransactionalEditingDomain domain,
                                                  AdapterFactory adapterFactory)
Initializes me with the editing domain in which I create read transactions and that adapter factory that provides content providers.

Parameters:
domain - my editing domain
adapterFactory - the adapter factory
Method Detail

run

protected <T> T run(RunnableWithResult<? extends T> run)
Runs the specified runnable in the editing domain, with interrupt handling.

Type Parameters:
T - the result type of the runnable
Parameters:
run - the runnable to run
Returns:
its result, or null on interrupt

createPropertySource

protected IPropertySource createPropertySource(Object object,
                                               IItemPropertySource itemPropertySource)
Extends the inherited implementation by running in a read-only transaction. The returned property source also uses transactions to access properties.

Overrides:
createPropertySource in class AdapterFactoryContentProvider

getChildren

public Object[] getChildren(Object object)
Extends the inherited implementation by running in a read-only transaction.

Specified by:
getChildren in interface ITreeContentProvider
Overrides:
getChildren in class AdapterFactoryContentProvider

getElements

public Object[] getElements(Object object)
Extends the inherited implementation by running in a read-only transaction.

Specified by:
getElements in interface IStructuredContentProvider
Overrides:
getElements in class AdapterFactoryContentProvider

getParent

public Object getParent(Object object)
Extends the inherited implementation by running in a read-only transaction.

Specified by:
getParent in interface ITreeContentProvider
Overrides:
getParent in class AdapterFactoryContentProvider

getPropertySource

public IPropertySource getPropertySource(Object object)
Extends the inherited implementation by running in a read-only transaction. The returned property source also uses transactions to access properties.

Specified by:
getPropertySource in interface IPropertySourceProvider
Overrides:
getPropertySource in class AdapterFactoryContentProvider

hasChildren

public boolean hasChildren(Object object)
Extends the inherited implementation by running in a read-only transaction.

Specified by:
hasChildren in interface ITreeContentProvider
Overrides:
hasChildren in class AdapterFactoryContentProvider

inputChanged

public void inputChanged(Viewer vwr,
                         Object oldInput,
                         Object newInput)
Extends the inherited implementation by running in a read-only transaction.

Specified by:
inputChanged in interface IContentProvider
Overrides:
inputChanged in class AdapterFactoryContentProvider

wrap

protected IPropertySource wrap(IPropertySource propertySource)
Wraps a property source in a transactional property source.

Parameters:
propertySource - the property source to wrap
Returns:
a wrapper that delegates to the original property source within transactions

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.