org.eclipse.emf.edit.provider
Class ReflectiveItemProvider

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.emf.edit.provider.ItemProviderAdapter
          extended by org.eclipse.emf.edit.provider.ReflectiveItemProvider
All Implemented Interfaces:
Adapter, Adapter.Internal, ResourceLocator, CreateChildCommand.Helper, IChangeNotifier, IDisposable, IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider

public class ReflectiveItemProvider
extends ItemProviderAdapter
implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource

This adapter implementation provides reflective support that emulates the behaviour of a default generated item provider.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
ItemProviderAdapter.ChildrenStore, ItemProviderAdapter.ModifiableSingletonEList<E>, ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommand, ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommandActionDelegate
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
Adapter.Internal
 
Field Summary
protected  java.util.List<EClass> allEClasses
           
protected  java.util.List<EPackage> allEPackages
           
protected  java.util.List<EObject> allRoots
           
 
Fields inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
adapterFactory, changeNotifier, childrenFeatures, childrenReferences, childrenStoreMap, itemPropertyDescriptors, targets, wrappers, wrappingNeeded
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
ReflectiveItemProvider(AdapterFactory adapterFactory)
           
 
Method Summary
protected  java.lang.String capName(java.lang.String name)
           
protected  void collectNewChildDescriptors(java.util.Collection<java.lang.Object> newChildDescriptors, java.lang.Object object)
          This adds to newChildDescriptors, a collection of new child descriptors.
 java.lang.String format(java.lang.String name, char separator)
           
protected  void gatherAllMetaData(EObject eObject)
           
protected  void gatherMetaData(EModelElement eModelElement)
           
protected  java.util.List<EClass> getAllChildConcreteSubclasses(EReference eReference)
           
protected  java.util.List<EClass> getAllConcreteSubclasses(EClass eClass)
           
protected  java.util.List<? extends EStructuralFeature> getAllDelegatedFeatures(EStructuralFeature feature)
           
protected  java.util.List<EClass> getAllEClasses(EClass eClass)
           
protected  java.util.List<EPackage> getAllEPackages(EClass eClass)
           
protected  java.util.Collection<? extends EStructuralFeature> getChildrenFeatures(java.lang.Object object)
          If this is defined to be something other than an empty list, it is used to implement getChildren, including in determining whether to cache children and, if so, in setting up the store.
 java.lang.Object getCreateChildImage(java.lang.Object owner, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the icon image for CreateChildCommand.
 java.lang.String getCreateChildText(java.lang.Object owner, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the label for CreateChildCommand.
protected  java.lang.String getFeatureText(java.lang.Object feature)
          This looks up the name of the specified feature.
 java.lang.Object getImage(java.lang.Object object)
          This implements IItemLabelProvider.getImage by returning null.
protected  EStructuralFeature getLabelFeature(EClass eClass)
           
 java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
          This implements IItemPropertySource.getPropertyDescriptors by returning the locally stored vector of descriptors.
 java.lang.String getText(java.lang.Object object)
          This implements IItemLabelProvider.getText by simply calling toString on the argument.
protected  java.lang.String getTypeText(EAttribute attribute)
          This looks up the name of the type of the specified attribute.
protected  java.lang.String getTypeText(java.lang.Object object)
          This looks up the name of the type of the specified object.
protected  boolean isWrappingNeeded(java.lang.Object object)
          Returns whether this item provider may need to use wrappers for some or all of the values it returns as children.
 void notifyChanged(Notification notification)
          Does nothing; clients may override so that it does something.
protected  java.util.List<java.lang.String> parseName(java.lang.String sourceName, char sourceSeparator)
           
 
Methods inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
addListener, adjustWrapperIndex, adjustWrapperIndices, adjustWrapperIndices, createAddCommand, createAddCommand, createChildParameter, createChildrenStore, createCommand, createCopyCommand, createCreateChildCommand, createCreateChildCommand, createCreateCopyCommand, createDragAndDropCommand, createInitializeCopyCommand, createItemPropertyDescriptor, createItemPropertyDescriptor, createMoveCommand, createMoveCommand, createRemoveCommand, createRemoveCommand, createReplaceCommand, createReplaceCommand, createSetCommand, createSetCommand, createWrapper, crop, dispose, disposeWrapper, disposeWrappers, factorAddCommand, factorMoveCommand, factorRemoveCommand, fireNotifyChanged, getAdapterFactory, getBackground, getBackground, getBaseURL, getChildFeature, getChildReference, getChildren, getChildrenReferences, getChildrenStore, getColumnImage, getColumnText, getCreateChildDescription, getCreateChildResult, getCreateChildToolTipText, getEditableValue, getElements, getFeatureValue, getFont, getFont, getForeground, getForeground, getImage, getNewChildDescriptors, getParent, getPropertyDescriptor, getPropertyValue, getReferenceValue, getResourceLocator, getResourceLocator, getRootAdapterFactory, getSetFeature, getSetFeatures, getString, getString, getString, getString, getString, getString, getString, getString, getUpdateableText, getWrappedValues, hasChildren, hasChildren, isAdapterForType, isEquivalentValue, isPropertySet, isValidValue, overlayImage, removeListener, resetPropertyValue, setPropertyValue, setTarget, shouldTranslate, unsetTarget, unwrap, unwrapCommandValues, updateChildren, wrap, wrapCommand
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget
 
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.edit.provider.IEditingDomainItemProvider
createCommand, getChildren, getNewChildDescriptors, getParent
 
Methods inherited from interface org.eclipse.emf.edit.provider.ITreeItemContentProvider
getChildren, getParent, hasChildren
 
Methods inherited from interface org.eclipse.emf.edit.provider.IItemPropertySource
getEditableValue, getPropertyDescriptor
 

Field Detail

allRoots

protected java.util.List<EObject> allRoots

allEPackages

protected java.util.List<EPackage> allEPackages

allEClasses

protected java.util.List<EClass> allEClasses
Constructor Detail

ReflectiveItemProvider

public ReflectiveItemProvider(AdapterFactory adapterFactory)
Method Detail

getPropertyDescriptors

public java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
Description copied from class: ItemProviderAdapter
This implements IItemPropertySource.getPropertyDescriptors by returning the locally stored vector of descriptors. This vector could be populated in the constructor of a derived class but it's probably more efficient to create them only on demand by overriding this method. You'll probably want to call super.getPropertyDescriptors if you do this, since you may have one adapter derive from another.

Specified by:
getPropertyDescriptors in interface IItemPropertySource
Overrides:
getPropertyDescriptors in class ItemProviderAdapter

gatherAllMetaData

protected void gatherAllMetaData(EObject eObject)

getAllEClasses

protected java.util.List<EClass> getAllEClasses(EClass eClass)

getAllEPackages

protected java.util.List<EPackage> getAllEPackages(EClass eClass)

gatherMetaData

protected void gatherMetaData(EModelElement eModelElement)

getAllChildConcreteSubclasses

protected java.util.List<EClass> getAllChildConcreteSubclasses(EReference eReference)

getAllConcreteSubclasses

protected java.util.List<EClass> getAllConcreteSubclasses(EClass eClass)

getChildrenFeatures

protected java.util.Collection<? extends EStructuralFeature> getChildrenFeatures(java.lang.Object object)
Description copied from class: ItemProviderAdapter
If this is defined to be something other than an empty list, it is used to implement getChildren, including in determining whether to cache children and, if so, in setting up the store. It is also used to deduce the appropriate feature for an AddCommand, RemoveCommand or MoveCommand in createCommand. If you override those methods, then you don't need to implement this.

Overrides:
getChildrenFeatures in class ItemProviderAdapter

getImage

public java.lang.Object getImage(java.lang.Object object)
Description copied from class: ItemProviderAdapter
This implements IItemLabelProvider.getImage by returning null. Most things really should have an icon, but not having one is technically correct too.

Specified by:
getImage in interface IItemLabelProvider
Overrides:
getImage in class ItemProviderAdapter

getText

public java.lang.String getText(java.lang.Object object)
Description copied from class: ItemProviderAdapter
This implements IItemLabelProvider.getText by simply calling toString on the argument. This will often be correct as is.

Specified by:
getText in interface IItemLabelProvider
Overrides:
getText in class ItemProviderAdapter

getLabelFeature

protected EStructuralFeature getLabelFeature(EClass eClass)

capName

protected java.lang.String capName(java.lang.String name)

format

public java.lang.String format(java.lang.String name,
                               char separator)

parseName

protected java.util.List<java.lang.String> parseName(java.lang.String sourceName,
                                                     char sourceSeparator)

getAllDelegatedFeatures

protected java.util.List<? extends EStructuralFeature> getAllDelegatedFeatures(EStructuralFeature feature)

collectNewChildDescriptors

protected void collectNewChildDescriptors(java.util.Collection<java.lang.Object> newChildDescriptors,
                                          java.lang.Object object)
Description copied from class: ItemProviderAdapter
This adds to newChildDescriptors, a collection of new child descriptors. Typically, CommandParameters will be used as descriptors. This implementation adds nothing to the collection, but derived classes should override this method, invoking the superclass implementation and then adding to the collection.

Overrides:
collectNewChildDescriptors in class ItemProviderAdapter

getCreateChildText

public java.lang.String getCreateChildText(java.lang.Object owner,
                                           java.lang.Object feature,
                                           java.lang.Object child,
                                           java.util.Collection<?> selection)
Description copied from class: ItemProviderAdapter
This returns the label for CreateChildCommand.

Specified by:
getCreateChildText in interface CreateChildCommand.Helper
Overrides:
getCreateChildText in class ItemProviderAdapter

getCreateChildImage

public java.lang.Object getCreateChildImage(java.lang.Object owner,
                                            java.lang.Object feature,
                                            java.lang.Object child,
                                            java.util.Collection<?> selection)
Description copied from class: ItemProviderAdapter
This returns the icon image for CreateChildCommand.

Specified by:
getCreateChildImage in interface CreateChildCommand.Helper
Overrides:
getCreateChildImage in class ItemProviderAdapter

getTypeText

protected java.lang.String getTypeText(java.lang.Object object)
Description copied from class: ItemProviderAdapter
This looks up the name of the type of the specified object.

Overrides:
getTypeText in class ItemProviderAdapter

getTypeText

protected java.lang.String getTypeText(EAttribute attribute)
Description copied from class: ItemProviderAdapter
This looks up the name of the type of the specified attribute.

Overrides:
getTypeText in class ItemProviderAdapter

getFeatureText

protected java.lang.String getFeatureText(java.lang.Object feature)
Description copied from class: ItemProviderAdapter
This looks up the name of the specified feature.

Overrides:
getFeatureText in class ItemProviderAdapter

notifyChanged

public void notifyChanged(Notification notification)
Description copied from class: AdapterImpl
Does nothing; clients may override so that it does something.

Specified by:
notifyChanged in interface Adapter
Overrides:
notifyChanged in class AdapterImpl
Parameters:
notification - a description of the change.

isWrappingNeeded

protected boolean isWrappingNeeded(java.lang.Object object)
Description copied from class: ItemProviderAdapter
Returns whether this item provider may need to use wrappers for some or all of the values it returns as children. This is used to determine whether to use a store to keep track of children and whether to use command wrappers that re-wrap results and affected objects. The default implementation of createWrapper also tests this method and will not create any wrappers if it returns false.

This implementation consults getChildrenFeatures, returning true if any feature map or simple attributes contribute children. This provides backwards compatibility with pre-2.0 subclasses and enables the more useful new default behaviour for attributes, which were previously not allowed. Subclasses may override this to enable wrapping of cross-referenced model objects, or to immediately return true or false, as desired. This is a convenient way to disable all of the new wrapping features in 2.0.

Overrides:
isWrappingNeeded in class ItemProviderAdapter

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