Overview

 
Package  Use  Tree  Deprecated  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

org.eclipse.emf.edit.provider
Class ItemProviderAdapter

java.lang.Object
  extended byorg.eclipse.emf.common.notify.impl.AdapterImpl
      extended byorg.eclipse.emf.edit.provider.ItemProviderAdapter

All Implemented Interfaces:
Adapter, CreateChildCommand.Helper, IChangeNotifier, IDisposable, ResourceLocator

Direct Known Subclasses:
ChangeDescriptionItemProvider, EObjectItemProvider, EObjectToChangesMapEntryItemProvider, EStringToStringMapEntryItemProvider, FeatureChangeItemProvider, GenBaseItemProvider, ListChangeItemProvider, MappingItemProviderAdapter, ReflectiveItemProvider, ResourceChangeItemProvider, ResourceItemProvider, ResourceSetItemProvider, TreeNodeItemProvider


public class ItemProviderAdapter
extends AdapterImpl
implements IChangeNotifier, IDisposable, CreateChildCommand.Helper, ResourceLocator

This adapter implementation provides a convenient reusable base for adapters that will be used as item providers. Default implementations for the following interfaces are provided: IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider, and IEditingDomainItemProvider. Also, IUpdateableItemText.getUpdateableText(java.lang.Object) is implemented to delegate to getText(java.lang.Object); often the editable text will be just the text, in which case this is a good default implementation.


Nested Class Summary
protected static class ItemProviderAdapter.ChildrenStore
          A ChildrenStore stores a number of objects that are to be presented as the children of an object.
protected static class ItemProviderAdapter.ModifiableSingletonEList
          A single-element implementation of EList.
 class ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommand
          A ResultAndAffectedObjectsWrappingCommand wraps another command to substitute IWrapperItemProviders for their values in the command's result and affected objects.
 class ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommandActionDelegate
          A ResultAndAffectedObjectsWrappingCommandActionDelegate wraps another command that also implements CommandActionDelegate, to substitute IWrapperItemProviders for its values, which have been unwrapped for the command to operate on properly.
 
Field Summary
protected  AdapterFactory adapterFactory
          This keeps track of the adapter factory that created this adaptor.
protected  IChangeNotifier changeNotifier
          This is used to implement IChangeNotifier.
protected  List childrenFeatures
          This is used to store all the children features.
protected  List childrenReferences
          Deprecated. As of EMF 2.0, replaced by childrenFeatures.
protected  Map childrenStoreMap
          When ItemProviderAdapter.ChildrenStores are to be used to cache children (typically to hold wrappers for non-EObject children), this maps adapted objects to their corresponding stores.
protected  List itemPropertyDescriptors
          This is used to store all the property descriptors.
protected  Collection targets
          This keeps track of all the targets to which this adapter is set.
protected  Disposable wrappers
          This holds children wrappers that are created by this item provider, so that they can be disposed with it.
protected  Boolean wrappingNeeded
          This caches the result returned by isWrappingNeeded so that it need not be recomputed each time.
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
ItemProviderAdapter(AdapterFactory adapterFactory)
          An instance is created from an adapter factory.
 
Method Summary
 void addListener(INotifyChangedListener listener)
          This adds another listener.
protected  void adjustWrapperIndex(Object object, int increment)
          If the given object implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment.
protected  void adjustWrapperIndices(List objects, int from, int increment)
          For each element of the given list, starting at from, that implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment.
protected  void adjustWrapperIndices(List objects, int from, int to, int increment)
          For each element of the given list, between from and to, that implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment.
protected  void collectNewChildDescriptors(Collection newChildDescriptors, Object object)
          This adds to newChildDescriptors, a collection of CommandParameters, parameters for possible children of the specified object, when viewed as an instance of the type for which this is an item provider.
protected  Command createAddCommand(EditingDomain domain, EObject owner, EReference feature, Collection collection, int index)
          Deprecated. As of EMF 2.0, replaced by createAddCommand.
protected  Command createAddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Collection collection, int index)
          This creates a primitive AddCommand.
protected  CommandParameter createChildParameter(Object feature, Object child)
          This is a convenience method that creates a CommandParameter for a given parent feature and child object.
protected  ItemProviderAdapter.ChildrenStore createChildrenStore(Object object)
          Consults isWrappingNeeded to decide whether to create a store for the children of the given object.
 Command createCommand(Object object, EditingDomain domain, Class commandClass, CommandParameter commandParameter)
          This implements delegated command creation for the given object.
protected  Command createCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
          This creates a primitive CopyCommand.
protected  Command createCreateChildCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, int index, Collection collection)
          Deprecated. As of EMF 2.0, replaced by createCreateChildCommand.
protected  Command createCreateChildCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index, Collection collection)
          This creates a primitive CreateChildCommand.
protected  Command createCreateCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
          This creates a primitive CreateCopyCommand.
protected  Command createDragAndDropCommand(EditingDomain domain, Object owner, float location, int operations, int operation, Collection collection)
          This creates a primitive DragAndDropCommand.
protected  Command createInitializeCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
          This creates a primitive InitializeCopyCommand.
protected  Command createMoveCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, int index)
          Deprecated. As of EMF 2.0, replaced by createMoveCommand.
protected  Command createMoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index)
          This creates a primitive MoveCommand.
protected  Command createRemoveCommand(EditingDomain domain, EObject owner, EReference feature, Collection collection)
          Deprecated. As of EMF 2.0, replaced by createRemoveCommand.
protected  Command createRemoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Collection collection)
          This creates a primitive RemoveCommand.
protected  Command createReplaceCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, Collection collection)
          Deprecated. As of EMF 2.0, replaced by createReplaceCommand.
protected  Command createReplaceCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, EObject value, Collection collection)
          This creates a primitive ReplaceCommand.
protected  Command createSetCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value)
          This returned a primitive SetCommand, but it has been replaced, since this command can now take an index.
protected  Command createSetCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, Object value, int index)
          This creates a primitive SetCommand.
protected  Object createWrapper(EObject object, EStructuralFeature feature, Object value, int index)
          Creates and returns a wrapper for the given value, at the given index in the given feature of the given object if such a wrapper is needed; otherwise, returns the original value.
 void dispose()
          This will remove this adapter from all its the targets and dispose any remainging children wrappers in the children store.
protected  void disposeWrapper(Object object)
          If the given object implements IWrapperItemProvider, it is disposed by calling dispose.
protected  void disposeWrappers(List objects)
          Each element of the given list that implements IWrapperItemProvider is disposed by calling IWrapperItemProvider#dispose dispose} and is removed from wrappers.
protected  Command factorAddCommand(EditingDomain domain, CommandParameter commandParameter)
          This method factors an AddCommand for a collection of objects into one or more primitive add command, i.e., one per unique feature.
protected  Command factorMoveCommand(EditingDomain domain, CommandParameter commandParameter)
          This method factors a MoveCommand to determine the feature.
protected  Command factorRemoveCommand(EditingDomain domain, CommandParameter commandParameter)
          This method factors a RemoveCommand for a collection of objects into one or more primitive remove commands, i.e., one per unique feature.
 void fireNotifyChanged(Notification notification)
          This convenience method converts the arguments into an appropriate update call on the viewer.
 AdapterFactory getAdapterFactory()
          This provides access to the factory.
 URL getBaseURL()
          Get the base URL from the resource locator.
protected  EStructuralFeature getChildFeature(Object object, Object child)
          This returns the most appropriate feature of the object into which the given child could be added.
protected  EReference getChildReference(Object object, Object child)
          Deprecated. As of EMF 2.0, replaced by getChildFeature.
 Collection getChildren(Object object)
          This implements ITreeItemContentProvider.getChildren.
protected  Collection getChildrenFeatures(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.
protected  Collection getChildrenReferences(Object object)
          Deprecated. As of EMF 2.0, replaced by getChildrenFeatures.
protected  ItemProviderAdapter.ChildrenStore getChildrenStore(Object object)
          Returns the store for the children of the given object, or null if no such store is being maintained.
 String getCreateChildDescription(Object owner, Object feature, Object child, Collection selection)
          This returns the description for CreateChildCommand.
 Object getCreateChildImage(Object owner, Object feature, Object child, Collection selection)
          This returns the icon image for CreateChildCommand.
 Collection getCreateChildResult(Object child)
          This returns the result collection for CreateChildCommand.
 String getCreateChildText(Object owner, Object feature, Object child, Collection selection)
          This returns the label for CreateChildCommand.
 String getCreateChildToolTipText(Object owner, Object feature, Object child, Collection selection)
          This returns the tool tip text for CreateChildCommand.
 Object getEditableValue(Object object)
          This implements IItemPropertySource.getEditableValue by simply returning the object itself.
 Collection getElements(Object object)
          This implements IStructuredItemContentProvider.getElements by forwarding the call to getChildren.
protected  String getFeatureText(Object feature)
          This looks up the name of the specified feature.
protected  Object getFeatureValue(EObject object, EStructuralFeature feature)
          This method is called by factorRemoveCommand to retrieve the children objects of the features returned from getChildrenFeatures.
 Object getImage(Object object)
          This implements IItemLabelProvider.getImage by returning null.
 Object getImage(String key)
          Get an image from the resource locator.
 Collection getNewChildDescriptors(Object object, EditingDomain editingDomain, Object sibling)
          This implements IEditingDomainItemProvider.getNewChildDescriptors, returning CommandParameters to describe all the possible children that can be added to the specified object.
 Object getParent(Object object)
          This implements ITreeItemContentProvider.getParent by returning the EMF object's container.
 IItemPropertyDescriptor getPropertyDescriptor(Object object, Object propertyId)
          This convenience method finds a particular descriptor given its property name.
 List getPropertyDescriptors(Object object)
          This implements IItemPropertySource.getPropertyDescriptors by returning the locally stored vector of descriptors.
 Object getPropertyValue(Object object, String property)
          This implements a PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
protected  Object getReferenceValue(EObject object, EReference reference)
          Deprecated. As of EMF 2.0, replaced by getFeatureValue.
protected  ResourceLocator getResourceLocator()
          Get the resource locator for this adapter's resources.
protected  ResourceLocator getResourceLocator(Object anyObject)
          Get the resource locator from the adapter of the object, if possible.
protected  AdapterFactory getRootAdapterFactory()
          Gets the root factory if this local adapter factory is composed, otherwise just the local one.
protected  EStructuralFeature getSetFeature(Object object, Object value)
          This returns the most appropriate feature of the object into which the value be set.
protected  Collection getSetFeatures(Object object)
          If this is defined to be something other than an empty list, it is used to implement getSetFeature and to deduce the EMF feature in the SetCommand createCommand.
 String getString(String key)
          Get a translated string from the resource locator.
 String getString(String key, Object[] substitutions)
          Get a translated string from the resource locator, with substitutions.
protected  String getString(String key, String s0)
          Get a translated string from the resource locator, substituting another such translated string.
protected  String getString(String key, String s0, String s1)
          Get a translated string from the resource locator, substituting two other such translated strings.
 String getText(Object object)
          This implements IItemLabelProvider.getText by simply calling toString on the argument.
protected  String getTypeText(Object object)
          This looks up the name of the type of the specified object.
 String getUpdateableText(Object object)
          This implements IUpdateableItemText.getUpdateableText by simply calling getText(java.lang.Object).
protected  Collection getWrappedValues(CommandParameter commandParameter)
          Returns a collection of any objects in the given command parameter's collection and value, that implement IWrapperItemProvider.
 boolean hasChildren(Object object)
          This implements ITreeItemContentProvider.hasChildren by simply testing whether getChildren returns any children.
 boolean isAdapterForType(Object type)
          The adapter factory is used as the type key.
protected  boolean isEquivalentValue(Object value, Object referenceValue)
          Returns whether the given value is to be considered equivalent to the given reference value.
 boolean isPropertySet(Object object, String property)
          This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
protected  boolean isWrappingNeeded(Object object)
          Returns whether this item provider may need to use wrappers for some or all of the values it returns as children.
 void removeListener(INotifyChangedListener listener)
          This removes a listener.
 void resetPropertyValue(Object object, String property)
          This implements PropertySource.resetPropertyValue by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
 void setPropertyValue(Object object, String property, Object value)
          This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
 void setTarget(Notifier target)
          Sets the target from which the adapter will receive notification.
protected  Object unwrap(Object object)
          If the given object implements IWrapperItemProvider, it is unwrapped by obtaining a value from getValue.
protected  CommandParameter unwrapCommandValues(CommandParameter commandParameter, Class commandClass)
          If the given command parameter contains wrapped values that need to be unwrapped for the given command class to operate on, a new command parameter will be returned, with those values unwrapped; otherwise, the original one is returned.
protected  void updateChildren(Notification notification)
          Updates any cached children based on the given notification.
protected  Object wrap(EObject object, EStructuralFeature feature, Object value, int index)
          Wraps a value, if needed, and keeps the wrapper for disposal along with the item provider.
protected  Command wrapCommand(Command command, Object object, Class commandClass, CommandParameter commandParameter, CommandParameter oldCommandParameter)
          Returns a version of the given command that automatically re-wraps values that have been unwrapped when returning them as the command's result or affected objects.
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, notifyChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

 

Field Detail

 

 

adapterFactory

protected AdapterFactory adapterFactory

This keeps track of the adapter factory that created this adaptor. It is also used as the key/type for this adapter.


 

 

itemPropertyDescriptors

protected List itemPropertyDescriptors

This is used to store all the property descriptors. Derived classes should add descriptors to this vector.


 

 

childrenFeatures

protected List childrenFeatures

This is used to store all the children features. Derived classes should add features to this vector.


 

 

childrenReferences

protected List childrenReferences

Deprecated. As of EMF 2.0, replaced by childrenFeatures.

This stored the children references, but attributes may now contribute children, too. It is still present to support existing subclasses.


 

 

changeNotifier

protected IChangeNotifier changeNotifier

This is used to implement IChangeNotifier.


 

 

targets

protected Collection targets

This keeps track of all the targets to which this adapter is set.


 

 

childrenStoreMap

protected Map childrenStoreMap

When ItemProviderAdapter.ChildrenStores are to be used to cache children (typically to hold wrappers for non-EObject children), this maps adapted objects to their corresponding stores. Stores should be accessed and created via getChildrenStore and createChildrenStore.


 

 

wrappers

protected Disposable wrappers

This holds children wrappers that are created by this item provider, so that they can be disposed with it.


 

 

wrappingNeeded

protected Boolean wrappingNeeded

This caches the result returned by isWrappingNeeded so that it need not be recomputed each time.

Constructor Detail

 

 

ItemProviderAdapter

public ItemProviderAdapter(AdapterFactory adapterFactory)

An instance is created from an adapter factory. The factory is used as a key so that we always know which factory created this adapter.

Method Detail

 

 

isAdapterForType

public boolean isAdapterForType(Object type)

The adapter factory is used as the type key. This returns true, only if this adapter was created by the given factory.

Specified by:
isAdapterForType in interface Adapter
Overrides:
isAdapterForType in class AdapterImpl

Parameters:
type - the type.
Returns:
false


 

 

getAdapterFactory

public AdapterFactory getAdapterFactory()

This provides access to the factory.


 

 

addListener

public void addListener(INotifyChangedListener listener)

Description copied from interface: IChangeNotifier
This adds another listener.

Specified by:
addListener in interface IChangeNotifier


 

 

removeListener

public void removeListener(INotifyChangedListener listener)

Description copied from interface: IChangeNotifier
This removes a listener.

Specified by:
removeListener in interface IChangeNotifier


 

 

fireNotifyChanged

public void fireNotifyChanged(Notification notification)

This convenience method converts the arguments into an appropriate update call on the viewer. The event type is a value from the static constants in Notifier.

Specified by:
fireNotifyChanged in interface IChangeNotifier


 

 

getEditableValue

public Object getEditableValue(Object object)

This implements IItemPropertySource.getEditableValue by simply returning the object itself.


 

 

getPropertyDescriptors

public List getPropertyDescriptors(Object object)

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.


 

 

getPropertyDescriptor

public IItemPropertyDescriptor getPropertyDescriptor(Object object,
                                                     Object propertyId)

This convenience method finds a particular descriptor given its property name.


 

 

getPropertyValue

public Object getPropertyValue(Object object,
                               String property)

This implements a PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


 

 

isPropertySet

public boolean isPropertySet(Object object,
                             String property)

This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


 

 

resetPropertyValue

public void resetPropertyValue(Object object,
                               String property)

This implements PropertySource.resetPropertyValue by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


 

 

setPropertyValue

public void setPropertyValue(Object object,
                             String property,
                             Object value)

This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


 

 

getElements

public Collection getElements(Object object)

This implements IStructuredItemContentProvider.getElements by forwarding the call to getChildren. It seems that you almost always want getElements and getChildren to return the same thing, so this makes that easy.


 

 

getChildren

public Collection getChildren(Object object)

This implements ITreeItemContentProvider.getChildren. If children are already cached in a ItemProviderAdapter.ChildrenStore, they are returned. Otherwise, children are collected from the features returned by getChildrenFeatures. The collected children may or may not be cached, depending on the result of createChildrenStore; by default, no store is returned if getChildrenFeatures returns only containment references. All children are optionally wrapped before being cached and returned. Subclasses may override createWrapper to specify when and with what to wrap children.


 

 

hasChildren

public boolean hasChildren(Object object)

This implements ITreeItemContentProvider.hasChildren by simply testing whether getChildren returns any children. This implementation will always be right, however, for efficiency you may want to override it to return false or to compute the result in some other efficient way.


 

 

getChildrenFeatures

protected Collection getChildrenFeatures(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. 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.


 

 

getChildrenReferences

protected Collection getChildrenReferences(Object object)

Deprecated. As of EMF 2.0, replaced by getChildrenFeatures.

This returned the children references, but it has been replaced since attributes may now contribute children, too. If the replacement method is not overridden to return a non-empty list, this method will still be called to provide backwards compatibility.


 

 

getFeatureValue

protected Object getFeatureValue(EObject object,
                                 EStructuralFeature feature)

This method is called by factorRemoveCommand to retrieve the children objects of the features returned from getChildrenFeatures. For references, this default implementation calls the deprecated getReferenceValue to provide backwards compatibility.


 

 

getReferenceValue

protected Object getReferenceValue(EObject object,
                                   EReference reference)

Deprecated. As of EMF 2.0, replaced by getFeatureValue.

This method returned the children objects of the given reference, but it has been replaced since attributes may now contribute children, too. The replacement method still calls this method for references, to provide backwards compatibility.


 

 

getChildFeature

protected EStructuralFeature getChildFeature(Object object,
                                             Object child)

This returns the most appropriate feature of the object into which the given child could be added. This default implementation first calls the deprecated getChildReference, for backwards compatibility. If that does not yield a non-null result, it returns the first feature returned by getChildrenFeatures that has a type compatible with the child. You can override this to return a better result or to compute it more efficiently.


 

 

getChildReference

protected EReference getChildReference(Object object,
                                       Object child)

Deprecated. As of EMF 2.0, replaced by getChildFeature.

This returned the most appropriate reference for a given child, but has been replaced since attributes may now contribute children, too. The replacement first tries calling this method, for backwards compatibility.


 

 

getSetFeatures

protected Collection getSetFeatures(Object object)

If this is defined to be something other than an empty list, it is used to implement getSetFeature and to deduce the EMF feature in the SetCommand createCommand. If you override those, then you don't need to implement this.


 

 

getSetFeature

protected EStructuralFeature getSetFeature(Object object,
                                           Object value)

This returns the most appropriate feature of the object into which the value be set. This default implementation returns the first feature returned by getSetFeatures that has a type compatible with the value. You can override this to return a better result or to compute it more efficiently.


 

 

getParent

public Object getParent(Object object)

This implements ITreeItemContentProvider.getParent by returning the EMF object's container. This is used by certain commands to find an owner, where none is specified, and by the viewers, when trying to locate an arbitrary object within the view (i.e. during select and reveal operation).


 

 

getImage

public Object getImage(Object object)

This implements IItemLabelProvider.getImage by returning null. Most things really should have an icon, but not having one is technically correct too.


 

 

getText

public String getText(Object object)

This implements IItemLabelProvider.getText by simply calling toString on the argument. This will often be correct as is.


 

 

getUpdateableText

public String getUpdateableText(Object object)

This implements IUpdateableItemText.getUpdateableText by simply calling getText(java.lang.Object). This will often be correct as is.


 

 

getNewChildDescriptors

public Collection getNewChildDescriptors(Object object,
                                         EditingDomain editingDomain,
                                         Object sibling)

This implements IEditingDomainItemProvider.getNewChildDescriptors, returning CommandParameters to describe all the possible children that can be added to the specified object.

This implementation invokes collectNewChildDescriptors, which should be overridden by derived classes, to build this collection.

If sibling is non-null, an index is added to each CommandParameter with a multi-valued feature, to ensure that the new child object gets added in the right position.


 

 

isEquivalentValue

protected boolean isEquivalentValue(Object value,
                                    Object referenceValue)

Returns whether the given value is to be considered equivalent to the given reference value. This is true if it is the reference value or if it is a feature map entry whose value is the reference value.


 

 

collectNewChildDescriptors

protected void collectNewChildDescriptors(Collection newChildDescriptors,
                                          Object object)

This adds to newChildDescriptors, a collection of CommandParameters, parameters for possible children of the specified object, when viewed as an instance of the type for which this is an item provider. This implementation adds nothing to the collection, but derived classes should override this method, invoking the superclass implementation and then adding to the collection.


 

 

createCommand

public Command createCommand(Object object,
                             EditingDomain domain,
                             Class commandClass,
                             CommandParameter commandParameter)

This implements delegated command creation for the given object.


 

 

createSetCommand

protected Command createSetCommand(EditingDomain domain,
                                   EObject owner,
                                   EStructuralFeature feature,
                                   Object value,
                                   int index)

This creates a primitive SetCommand.


 

 

createSetCommand

protected Command createSetCommand(EditingDomain domain,
                                   EObject owner,
                                   EStructuralFeature feature,
                                   Object value)

This returned a primitive SetCommand, but it has been replaced, since this command can now take an index. The replacement method still calls this method when invoked with no index, to provide backwards compatibility.

This method will soon be deprecated. New code should use or override the new form, instead.


 

 

createCopyCommand

protected Command createCopyCommand(EditingDomain domain,
                                    EObject owner,
                                    CopyCommand.Helper helper)

This creates a primitive CopyCommand.


 

 

createCreateCopyCommand

protected Command createCreateCopyCommand(EditingDomain domain,
                                          EObject owner,
                                          CopyCommand.Helper helper)

This creates a primitive CreateCopyCommand.


 

 

createInitializeCopyCommand

protected Command createInitializeCopyCommand(EditingDomain domain,
                                              EObject owner,
                                              CopyCommand.Helper helper)

This creates a primitive InitializeCopyCommand.


 

 

createRemoveCommand

protected Command createRemoveCommand(EditingDomain domain,
                                      EObject owner,
                                      EStructuralFeature feature,
                                      Collection collection)

This creates a primitive RemoveCommand.


 

 

createRemoveCommand

protected Command createRemoveCommand(EditingDomain domain,
                                      EObject owner,
                                      EReference feature,
                                      Collection collection)

Deprecated. As of EMF 2.0, replaced by createRemoveCommand.

This returned a primitive RemoveCommand, but it has been replaced since this command is now used on attributes, too. The replacement method still calls this method for references, to provide backwards compatibility.


 

 

createReplaceCommand

protected Command createReplaceCommand(EditingDomain domain,
                                       EObject owner,
                                       EStructuralFeature feature,
                                       EObject value,
                                       Collection collection)

This creates a primitive ReplaceCommand.


 

 

createReplaceCommand

protected Command createReplaceCommand(EditingDomain domain,
                                       EObject owner,
                                       EReference feature,
                                       EObject value,
                                       Collection collection)

Deprecated. As of EMF 2.0, replaced by createReplaceCommand.

This returned a primitive ReplaceCommand, but it has been replaced since this command is now used on attributes, too. The replacement method still calls this method for references, to provide backwards compatibility.


 

 

createAddCommand

protected Command createAddCommand(EditingDomain domain,
                                   EObject owner,
                                   EStructuralFeature feature,
                                   Collection collection,
                                   int index)

This creates a primitive AddCommand.


 

 

createAddCommand

protected Command createAddCommand(EditingDomain domain,
                                   EObject owner,
                                   EReference feature,
                                   Collection collection,
                                   int index)

Deprecated. As of EMF 2.0, replaced by createAddCommand.

This returned a primitive AddCommand, but it has been replaced since this command is now used on attributes, too. The replacement method still calls this method for references, to provide backwards compatibility.


 

 

createMoveCommand

protected Command createMoveCommand(EditingDomain domain,
                                    EObject owner,
                                    EStructuralFeature feature,
                                    Object value,
                                    int index)

This creates a primitive MoveCommand.


 

 

createMoveCommand

protected Command createMoveCommand(EditingDomain domain,
                                    EObject owner,
                                    EReference feature,
                                    EObject value,
                                    int index)

Deprecated. As of EMF 2.0, replaced by createMoveCommand.

This returned a primitive MoveCommand, but it has been replaced since this command is now used on attributes, too. The replacement method still calls this method for references, to provide backwards compatibility.


 

 

createDragAndDropCommand

protected Command createDragAndDropCommand(EditingDomain domain,
                                           Object owner,
                                           float location,
                                           int operations,
                                           int operation,
                                           Collection collection)

This creates a primitive DragAndDropCommand.


 

 

createCreateChildCommand

protected Command createCreateChildCommand(EditingDomain domain,
                                           EObject owner,
                                           EStructuralFeature feature,
                                           Object value,
                                           int index,
                                           Collection collection)

This creates a primitive CreateChildCommand.


 

 

createCreateChildCommand

protected Command createCreateChildCommand(EditingDomain domain,
                                           EObject owner,
                                           EReference feature,
                                           EObject value,
                                           int index,
                                           Collection collection)

Deprecated. As of EMF 2.0, replaced by createCreateChildCommand.

This returned a primitive CreateChildCommand, but it has been replaced since this command is now used on attributes, too. The replacement method still calls this method for references, to provide backwards compatibility.


 

 

factorRemoveCommand

protected Command factorRemoveCommand(EditingDomain domain,
                                      CommandParameter commandParameter)

This method factors a RemoveCommand for a collection of objects into one or more primitive remove commands, i.e., one per unique feature.


 

 

factorAddCommand

protected Command factorAddCommand(EditingDomain domain,
                                   CommandParameter commandParameter)

This method factors an AddCommand for a collection of objects into one or more primitive add command, i.e., one per unique feature.


 

 

factorMoveCommand

protected Command factorMoveCommand(EditingDomain domain,
                                    CommandParameter commandParameter)

This method factors a MoveCommand to determine the feature.


 

 

setTarget

public void setTarget(Notifier target)

Description copied from interface: Adapter
Sets the target from which the adapter will receive notification. In general, an adapter may be shared by more than one notifier.

Specified by:
setTarget in interface Adapter
Overrides:
setTarget in class AdapterImpl


 

 

dispose

public void dispose()

This will remove this adapter from all its the targets and dispose any remainging children wrappers in the children store.

Specified by:
dispose in interface IDisposable


 

 

createChildParameter

protected CommandParameter createChildParameter(Object feature,
                                                Object child)

This is a convenience method that creates a CommandParameter for a given parent feature and child object.


 

 

getCreateChildResult

public Collection getCreateChildResult(Object child)

This returns the result collection for CreateChildCommand.

Specified by:
getCreateChildResult in interface CreateChildCommand.Helper


 

 

getCreateChildText

public String getCreateChildText(Object owner,
                                 Object feature,
                                 Object child,
                                 Collection selection)

This returns the label for CreateChildCommand.

Specified by:
getCreateChildText in interface CreateChildCommand.Helper


 

 

getCreateChildDescription

public String getCreateChildDescription(Object owner,
                                        Object feature,
                                        Object child,
                                        Collection selection)

This returns the description for CreateChildCommand.

Specified by:
getCreateChildDescription in interface CreateChildCommand.Helper


 

 

getCreateChildToolTipText

public String getCreateChildToolTipText(Object owner,
                                        Object feature,
                                        Object child,
                                        Collection selection)

This returns the tool tip text for CreateChildCommand.

Specified by:
getCreateChildToolTipText in interface CreateChildCommand.Helper


 

 

getCreateChildImage

public Object getCreateChildImage(Object owner,
                                  Object feature,
                                  Object child,
                                  Collection selection)

This returns the icon image for CreateChildCommand.

Specified by:
getCreateChildImage in interface CreateChildCommand.Helper


 

 

getTypeText

protected String getTypeText(Object object)

This looks up the name of the type of the specified object.


 

 

getFeatureText

protected String getFeatureText(Object feature)

This looks up the name of the specified feature.


 

 

getResourceLocator

protected ResourceLocator getResourceLocator()

Get the resource locator for this adapter's resources.


 

 

getResourceLocator

protected ResourceLocator getResourceLocator(Object anyObject)

Get the resource locator from the adapter of the object, if possible. it can be any object, i.e., it may not the type object for which this adapter is applicable.


 

 

getRootAdapterFactory

protected AdapterFactory getRootAdapterFactory()

Gets the root factory if this local adapter factory is composed, otherwise just the local one.


 

 

getBaseURL

public URL getBaseURL()

Get the base URL from the resource locator.

Specified by:
getBaseURL in interface ResourceLocator

Returns:
the URL from which all resources are based.


 

 

getImage

public Object getImage(String key)

Get an image from the resource locator.

Specified by:
getImage in interface ResourceLocator

Parameters:
key - the key of the image resource.
Returns:
the description on the image resource.


 

 

getString

public String getString(String key)

Get a translated string from the resource locator.

Specified by:
getString in interface ResourceLocator

Parameters:
key - the key of the string resource.
Returns:
the string resource associated with the key.


 

 

getString

public String getString(String key,
                        Object[] substitutions)

Get a translated string from the resource locator, with substitutions.

Specified by:
getString in interface ResourceLocator

Parameters:
key - the key of the string.
substitutions - the message substitutions.
Returns:
a string resource associated with the key.
See Also:
ResourceLocator.getString(String), MessageFormat.format(String, Object[])


 

 

getString

protected String getString(String key,
                           String s0)

Get a translated string from the resource locator, substituting another such translated string.


 

 

getString

protected String getString(String key,
                           String s0,
                           String s1)

Get a translated string from the resource locator, substituting two other such translated strings.


 

 

isWrappingNeeded

protected boolean isWrappingNeeded(Object object)

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.


 

 

getChildrenStore

protected ItemProviderAdapter.ChildrenStore getChildrenStore(Object object)

Returns the store for the children of the given object, or null if no such store is being maintained.


 

 

createChildrenStore

protected ItemProviderAdapter.ChildrenStore createChildrenStore(Object object)

Consults isWrappingNeeded to decide whether to create a store for the children of the given object. If so, the new store is created, added to the collection being maintained, and returned. If not, null is returned.


 

 

wrap

protected Object wrap(EObject object,
                      EStructuralFeature feature,
                      Object value,
                      int index)

Wraps a value, if needed, and keeps the wrapper for disposal along with the item provider. This method actually calls createWrapper to determine if the given value, at the given index in the given feature of the given object, should be wrapped and to obtain the wrapper. If a wrapper is obtained, it is recorded and returned. Otherwise, the orginal value is returned. Subclasses may override createWrapper to specify when and with what to wrap values.


 

 

createWrapper

protected Object createWrapper(EObject object,
                               EStructuralFeature feature,
                               Object value,
                               int index)

Creates and returns a wrapper for the given value, at the given index in the given feature of the given object if such a wrapper is needed; otherwise, returns the original value. This implementation consults isWrappingNeeded and, if it is true, creates different wrappers that implement IWrapperItemProvider for feature maps, simple attributes, and cross references. By default, isWrappingNeeded does not return true unless there is at least one feature map or simple attribute that contributes children, in order to maintain backwards compatibility. As a result, it may be necessary to override that method in order to wrap cross-referenced model objects here. Subclasses may also override this method, in order to create their own specialized wrappers.


 

 

unwrap

protected Object unwrap(Object object)

If the given object implements IWrapperItemProvider, it is unwrapped by obtaining a value from getValue. The unwrapping continues until a non-wrapper value is returned. This iterative unwrapping is required because values may be repeatedly wrapped, as children of a delegating wrapper.


 

 

disposeWrapper

protected void disposeWrapper(Object object)

If the given object implements IWrapperItemProvider, it is disposed by calling dispose. It is also removed from wrappers, as it will longer need to be disposed along with this item provider.


 

 

disposeWrappers

protected void disposeWrappers(List objects)

Each element of the given list that implements IWrapperItemProvider is disposed by calling IWrapperItemProvider#dispose dispose} and is removed from wrappers.


 

 

adjustWrapperIndex

protected void adjustWrapperIndex(Object object,
                                  int increment)

If the given object implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment.


 

 

adjustWrapperIndices

protected void adjustWrapperIndices(List objects,
                                    int from,
                                    int increment)

For each element of the given list, starting at from, that implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment.


 

 

adjustWrapperIndices

protected void adjustWrapperIndices(List objects,
                                    int from,
                                    int to,
                                    int increment)

For each element of the given list, between from and to, that implements IWrapperItemProvider and specifies an index, that index is adjusted by the given increment.


 

 

updateChildren

protected void updateChildren(Notification notification)

Updates any cached children based on the given notification. If a ItemProviderAdapter.ChildrenStore exists for its notifier, then the children of the specified feature are updated.

Existing children in the store that correspond to any set, removed or unset values are disposed before being removed from the store. When children are added to, removed from, or moved within a feature, the indices of any others affected are adjusted. Since this method is typically called from notifyChanged, which, in subclasses, is often invoked repeatedly up the inheritance chain, it can be safely called repeatedly for a single notification, and only the first such call will have an effect. Such repeated calls may not, however, safely be interleaved with calls for another notification.


 

 

unwrapCommandValues

protected CommandParameter unwrapCommandValues(CommandParameter commandParameter,
                                               Class commandClass)

If the given command parameter contains wrapped values that need to be unwrapped for the given command class to operate on, a new command parameter will be returned, with those values unwrapped; otherwise, the original one is returned. For most commands, any objects in the collection or in the value that implement IWrapperItemProvider will be unwrapped. DragAndDropCommand and CreateChildCommand are never unwrapped.


 

 

wrapCommand

protected Command wrapCommand(Command command,
                              Object object,
                              Class commandClass,
                              CommandParameter commandParameter,
                              CommandParameter oldCommandParameter)

Returns a version of the given command that automatically re-wraps values that have been unwrapped when returning them as the command's result or affected objects. This is only done if isWrappingNeeded returns true, and never for a DragAndDropCommand.


 

 

getWrappedValues

protected Collection getWrappedValues(CommandParameter commandParameter)

Returns a collection of any objects in the given command parameter's collection and value, that implement IWrapperItemProvider.


 

Overview

 
Package  Use  Tree  Deprecated  Index  Help 
Copyright 2001-2004 IBM Corporation and others.
All Rights Reserved.
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD