org.eclipse.emf.edit.ui.provider
Class AdapterFactoryContentProvider

org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider
All Implemented Interfaces:
INotifyChangedListener, org.eclipse.ui.views.properties.IPropertySourceProvider
Direct Known Subclasses:
EcoreEditor.ReverseAdapterFactoryContentProvider, GenModelEditor.ReverseAdapterFactoryContentProvider

public class AdapterFactoryContentProvider
implements org.eclipse.ui.views.properties.IPropertySourceProvider, INotifyChangedListener

This content provider wraps an AdapterFactory and it delegates its JFace provider interfaces to corresponding adapter-implemented item provider interfaces. All method calls to the various structured content provider interfaces are delegated to interfaces implemented by the adapters generated by the AdapterFactory. IStructuredContentProvider is delegated to IStructuredItemContentProvider; ITreeContentProvider is delegated to ITreeItemContentProvider; and IPropertySourceProvider to IItemPropertySource.


Field Summary
protected  AdapterFactory adapterFactory
          This keeps track of the one factory we are using.
protected  org.eclipse.jface.viewers.Viewer viewer
          This keeps track of the one viewer using this content provider.
 
Constructor Summary
AdapterFactoryContentProvider(AdapterFactory adapterFactory)
          This constructs an instance that wraps this factory.
 
Method Summary
protected  org.eclipse.ui.views.properties.IPropertySource createPropertySource(java.lang.Object object, IItemPropertySource itemPropertySource)
           
 void dispose()
          This discards the content provider and removes this as a listener to the adapterFactory.
 AdapterFactory getAdapterFactory()
          This returns the wrapped factory.
 java.lang.Object[] getChildren(java.lang.Object object)
          This implements ITreeContentProvider.getChildren to forward the call to an object that implements ITreeItemContentProvider.getChildren.
 java.lang.Object[] getElements(java.lang.Object object)
          This implements IStructuredContentProvider.getElements to forward the call to an object that implements IStructuredItemContentProvider.getElements.
 java.lang.Object getParent(java.lang.Object object)
          This implements ITreeContentProvider.getParent to forward the call to an object that implements ITreeItemContentProvider.getParent.
 org.eclipse.ui.views.properties.IPropertySource getPropertySource(java.lang.Object object)
          This implements IPropertySourceProvider.getPropertySource to forward the call to an object that implements IItemPropertySource.
 boolean hasChildren(java.lang.Object object)
          This implements ITreeContentProvider.hasChildren to forward the call to an object that implements ITreeItemContentProvider.hasChildren.
 void inputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)
          The given Viewer will start (oldInput == null) or stop (newInput == null) listening for domain events.
 void notifyChanged(Notification notification)
           
 void setAdapterFactory(AdapterFactory adapterFactory)
          This sets the wrapped factory.
 

Field Detail

adapterFactory

protected AdapterFactory adapterFactory
This keeps track of the one factory we are using. Use a ComposedAdapterFactory if adapters from more the one factory are involved in the model.

viewer

protected org.eclipse.jface.viewers.Viewer viewer
This keeps track of the one viewer using this content provider.
Constructor Detail

AdapterFactoryContentProvider

public AdapterFactoryContentProvider(AdapterFactory adapterFactory)
This constructs an instance that wraps this factory. The factory should yield adapters that implement the various IItemContentProvider interfaces.
Method Detail

setAdapterFactory

public void setAdapterFactory(AdapterFactory adapterFactory)
This sets the wrapped factory.

getAdapterFactory

public AdapterFactory getAdapterFactory()
This returns the wrapped factory.

inputChanged

public void inputChanged(org.eclipse.jface.viewers.Viewer viewer,
                         java.lang.Object oldInput,
                         java.lang.Object newInput)
The given Viewer will start (oldInput == null) or stop (newInput == null) listening for domain events.

getElements

public java.lang.Object[] getElements(java.lang.Object object)
This implements IStructuredContentProvider.getElements to forward the call to an object that implements IStructuredItemContentProvider.getElements.

getChildren

public java.lang.Object[] getChildren(java.lang.Object object)
This implements ITreeContentProvider.getChildren to forward the call to an object that implements ITreeItemContentProvider.getChildren.

hasChildren

public boolean hasChildren(java.lang.Object object)
This implements ITreeContentProvider.hasChildren to forward the call to an object that implements ITreeItemContentProvider.hasChildren.

getParent

public java.lang.Object getParent(java.lang.Object object)
This implements ITreeContentProvider.getParent to forward the call to an object that implements ITreeItemContentProvider.getParent.

dispose

public void dispose()
This discards the content provider and removes this as a listener to the adapterFactory.

getPropertySource

public org.eclipse.ui.views.properties.IPropertySource getPropertySource(java.lang.Object object)
This implements IPropertySourceProvider.getPropertySource to forward the call to an object that implements IItemPropertySource.
Specified by:
getPropertySource in interface org.eclipse.ui.views.properties.IPropertySourceProvider

createPropertySource

protected org.eclipse.ui.views.properties.IPropertySource createPropertySource(java.lang.Object object,
                                                                               IItemPropertySource itemPropertySource)

notifyChanged

public void notifyChanged(Notification notification)
Specified by:
notifyChanged in interface INotifyChangedListener

Copyright 2001-2002 IBM Corporation and others.
All Rights Reserved.