org.eclipse.emf.edit.provider
Class ItemProviderAdapter

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.emf.edit.provider.ItemProviderAdapter
All Implemented Interfaces:
Adapter, Adapter.Internal, ResourceLocator, CreateChildCommand.Helper, IChangeNotifier, IDisposable
Direct Known Subclasses:
ChangeDescriptionItemProvider, EGenericTypeItemProvider, EModelElementItemProvider, ENamedElementToXMLInfoMapEntryItemProvider, EObjectItemProvider, EObjectToChangesMapEntryItemProvider, EStringToStringMapEntryItemProvider, FeatureChangeItemProvider, FeatureMapEntryItemProvider, GenBaseItemProvider, ListChangeItemProvider, MappingItemProviderAdapter, ReflectiveItemProvider, ResourceChangeItemProvider, ResourceItemProvider, ResourceSetItemProvider, TreeNodeItemProvider, XMLInfoItemProvider, XMLMapItemProvider

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, IItemColorProvider, IItemFontProvider, 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<E>
          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.
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
Adapter.Internal
 
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  java.util.List<EStructuralFeature> childrenFeatures
          This is used to store all the children features.
protected  java.util.List<EReference> childrenReferences
          Deprecated. As of EMF 2.0, replaced by childrenFeatures.
protected  java.util.Map<java.lang.Object,ItemProviderAdapter.ChildrenStore> 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  java.util.List<IItemPropertyDescriptor> itemPropertyDescriptors
          This is used to store all the property descriptors.
protected  java.util.List<Notifier> 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  java.lang.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(java.lang.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(java.util.List<java.lang.Object> 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(java.util.List<java.lang.Object> 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(java.util.Collection<java.lang.Object> newChildDescriptors, java.lang.Object object)
          This adds to newChildDescriptors, a collection of new child descriptors.
protected  Command createAddCommand(EditingDomain domain, EObject owner, EReference feature, java.util.Collection<?> collection, int index)
          Deprecated. As of EMF 2.0, replaced by createAddCommand.
protected  Command createAddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.util.Collection<?> collection, int index)
          This creates a primitive AddCommand.
protected  CommandParameter createChildParameter(java.lang.Object feature, java.lang.Object child)
          This is a convenience method that creates a CommandParameter for a given parent feature and child object.
protected  ItemProviderAdapter.ChildrenStore createChildrenStore(java.lang.Object object)
          Consults isWrappingNeeded to decide whether to create a store for the children of the given object.
 Command createCommand(java.lang.Object object, EditingDomain domain, java.lang.Class<? extends Command> 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, java.util.Collection<?> collection)
          Deprecated. As of EMF 2.0, replaced by createCreateChildCommand.
protected  Command createCreateChildCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.lang.Object value, int index, java.util.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, java.lang.Object owner, float location, int operations, int operation, java.util.Collection<?> collection)
          This creates a primitive DragAndDropCommand.
protected  Command createInitializeCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper)
          This creates a primitive InitializeCopyCommand.
protected  ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory, ResourceLocator resourceLocator, java.lang.String displayName, java.lang.String description, EStructuralFeature feature, boolean isSettable, boolean multiLine, boolean sortChoices, java.lang.Object staticImage, java.lang.String category, java.lang.String[] filterFlags)
          Creates an instance that uses a resource locator; indicates whether to be multi-line and to sort choices; specifies a static image, a category, and filter flags; and determines the cell editor from the type of the structural feature.
protected  ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory, ResourceLocator resourceLocator, java.lang.String displayName, java.lang.String description, EStructuralFeature feature, boolean isSettable, java.lang.Object staticImage, java.lang.String category, java.lang.String[] filterFlags)
          This creates an item provider descriptor that uses a resource locator; specifies a static image, a category, and filter flags; and determines the cell editor from the type of the structural feature.
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, java.lang.Object value, int index)
          This creates a primitive MoveCommand.
protected  Command createRemoveCommand(EditingDomain domain, EObject owner, EReference feature, java.util.Collection<?> collection)
          Deprecated. As of EMF 2.0, replaced by createRemoveCommand.
protected  Command createRemoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.util.Collection<?> collection)
          This creates a primitive RemoveCommand.
protected  Command createReplaceCommand(EditingDomain domain, EObject owner, EReference feature, EObject value, java.util.Collection<?> collection)
          Deprecated. As of EMF 2.0, replaced by createReplaceCommand.
protected  Command createReplaceCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, EObject value, java.util.Collection<?> collection)
          This creates a primitive ReplaceCommand.
protected  Command createSetCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.lang.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, java.lang.Object value, int index)
          This creates a primitive SetCommand.
protected  java.lang.Object createWrapper(EObject object, EStructuralFeature feature, java.lang.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.
 java.lang.String crop(java.lang.String text)
          This crops the given text to exclude any control characters.
 void dispose()
          This will remove this adapter from all its the targets and dispose any remaining children wrappers in the children store.
protected  void disposeWrapper(java.lang.Object object)
          If the given object implements IWrapperItemProvider, it is disposed by calling dispose.
protected  void disposeWrappers(java.util.List<?> objects)
          Each element of the given list that implements IWrapperItemProvider is disposed by calling 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.
 java.lang.Object getBackground(java.lang.Object object)
          This implements IItemColorProvider.getBackground by returning null;
 java.lang.Object getBackground(java.lang.Object object, int columnIndex)
          This implements ITableItemColorProvider.getBackground by returning null;
 java.net.URL getBaseURL()
          Get the base URL from the resource locator.
protected  EStructuralFeature getChildFeature(java.lang.Object object, java.lang.Object child)
          This returns the most appropriate feature of the object into which the given child could be added.
protected  EReference getChildReference(java.lang.Object object, java.lang.Object child)
          Deprecated. As of EMF 2.0, replaced by getChildFeature.
 java.util.Collection<?> getChildren(java.lang.Object object)
          This implements ITreeItemContentProvider.getChildren.
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.
protected  java.util.Collection<? extends EReference> getChildrenReferences(java.lang.Object object)
          Deprecated. As of EMF 2.0, replaced by getChildrenFeatures.
protected  ItemProviderAdapter.ChildrenStore getChildrenStore(java.lang.Object object)
          Returns the store for the children of the given object, or null if no such store is being maintained.
 java.lang.Object getColumnImage(java.lang.Object object, int columnIndex)
          This implements ITableItemLabelProvider.getColumnImage by returning null.
 java.lang.String getColumnText(java.lang.Object object, int columnIndex)
          This implements ITableItemLabelProvider.getColumnText by returning "".
 java.lang.String getCreateChildDescription(java.lang.Object owner, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the description for CreateChildCommand.
 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.util.Collection<?> getCreateChildResult(java.lang.Object child)
          This returns the result collection 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.
 java.lang.String getCreateChildToolTipText(java.lang.Object owner, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the tool tip text for CreateChildCommand.
 java.lang.Object getEditableValue(java.lang.Object object)
          This implements IItemPropertySource.getEditableValue by simply returning the object itself.
 java.util.Collection<?> getElements(java.lang.Object object)
          This implements IStructuredItemContentProvider.getElements by forwarding the call to getChildren.
protected  java.lang.String getFeatureText(java.lang.Object feature)
          This looks up the name of the specified feature.
protected  java.lang.Object getFeatureValue(EObject object, EStructuralFeature feature)
          This method is called by factorRemoveCommand to retrieve the children objects of the features returned from getChildrenFeatures.
 java.lang.Object getFont(java.lang.Object object)
          This implements IItemFontProvider.getFont by returning null;
 java.lang.Object getFont(java.lang.Object object, int columnIndex)
          This implements ITableItemFontProvider.getFont by returning null;
 java.lang.Object getForeground(java.lang.Object object)
          This implements IItemColorProvider.getForeground by returning null;
 java.lang.Object getForeground(java.lang.Object object, int columnIndex)
          This implements ITableItemColorProvider.getForeground by returning null;
 java.lang.Object getImage(java.lang.Object object)
          This implements IItemLabelProvider.getImage by returning null.
 java.lang.Object getImage(java.lang.String key)
          Get an image from the resource locator.
 java.util.Collection<?> getNewChildDescriptors(java.lang.Object object, EditingDomain editingDomain, java.lang.Object sibling)
          This implements IEditingDomainItemProvider.getNewChildDescriptors, returning descriptors for all the possible children that can be added to the specified object.
 java.lang.Object getParent(java.lang.Object object)
          This implements ITreeItemContentProvider.getParent by returning the EMF object's container.
 IItemPropertyDescriptor getPropertyDescriptor(java.lang.Object object, java.lang.Object propertyId)
          This convenience method finds a particular descriptor given its ID or feature.
 java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
          This implements IItemPropertySource.getPropertyDescriptors by returning the locally stored vector of descriptors.
 java.lang.Object getPropertyValue(java.lang.Object object, java.lang.String property)
          This implements a PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
protected  java.lang.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(java.lang.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(java.lang.Object object, java.lang.Object value)
          This returns the most appropriate feature of the object into which the value be set.
protected  java.util.Collection<? extends EStructuralFeature> getSetFeatures(java.lang.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.
 java.lang.String getString(java.lang.String key)
          Get a translated string from the resource locator.
 java.lang.String getString(java.lang.String key, boolean translate)
          Get a translated string from the resource locator.
 java.lang.String getString(java.lang.String key, java.lang.Object[] substitutions)
          Get a translated string from the resource locator, with substitutions.
 java.lang.String getString(java.lang.String key, java.lang.Object[] substitutions, boolean translate)
          Get a translated string from the resource locator, with substitutions.
protected  java.lang.String getString(java.lang.String key, java.lang.String s0)
          Get a translated string from the resource locator, substituting another such translated string.
protected  java.lang.String getString(java.lang.String key, java.lang.String s0, boolean translate)
          Get a translated string from the resource locator, substituting another such translated string.
protected  java.lang.String getString(java.lang.String key, java.lang.String s0, java.lang.String s1)
          Get a translated string from the resource locator, substituting two other such translated strings.
protected  java.lang.String getString(java.lang.String key, java.lang.String s0, java.lang.String s1, boolean translate)
          Get a translated string from the resource locator, substituting two other such translated strings.
 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.
 java.lang.String getUpdateableText(java.lang.Object object)
          This implements IUpdateableItemText.getUpdateableText by simply calling getText(java.lang.Object).
protected  java.lang.Object getValue(EObject eObject, EStructuralFeature eStructuralFeature)
          Returns the value of the feature.
protected  java.util.Collection<? extends IWrapperItemProvider> getWrappedValues(CommandParameter commandParameter)
          Returns a collection of any objects in the given command parameter's collection and value, that implement IWrapperItemProvider.
 boolean hasChildren(java.lang.Object object)
          This implements ITreeItemContentProvider.hasChildren by simply testing whether getChildren returns any children.
protected  boolean hasChildren(java.lang.Object object, boolean optimized)
          This implements ITreeItemContentProvider.hasChildren.
 boolean isAdapterForType(java.lang.Object type)
          The adapter factory is used as the type key.
protected  boolean isEquivalentValue(java.lang.Object value, java.lang.Object referenceValue)
          Returns whether the given value is to be considered equivalent to the given reference value.
 boolean isPropertySet(java.lang.Object object, java.lang.String property)
          This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
protected  boolean isResolveProxies()
          Returns whether proxies should be resolved when reflectively fetching values of features.
protected  boolean isValidValue(java.lang.Object object, java.lang.Object value, EStructuralFeature feature)
          This returns whether the given value is an appropriate instance for the given feature of the given 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.
protected  java.lang.Object overlayImage(java.lang.Object object, java.lang.Object image)
          This adds an overlay to the given image if the object is controlled.
 void removeListener(INotifyChangedListener listener)
          This removes a listener.
 void resetPropertyValue(java.lang.Object object, java.lang.String property)
          This implements PropertySource.resetPropertyValue by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface
 void setPropertyValue(java.lang.Object object, java.lang.String property, java.lang.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  boolean shouldComposeCreationImage()
          Indicates whether creation icon images should always be composed in getCreateChildImage(Object, Object, Object, Collection).
protected  boolean shouldTranslate()
          Indicates whether strings should be translated by default.
 void unsetTarget(Notifier target)
          Unsets the target from which the adapter will receive notification.
protected  java.lang.Object unwrap(java.lang.Object object)
          If the given object implements IWrapperItemProvider, it is unwrapped by obtaining a value from getValue.
protected  CommandParameter unwrapCommandValues(CommandParameter commandParameter, java.lang.Class<? extends Command> 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  java.lang.Object wrap(EObject object, EStructuralFeature feature, java.lang.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, java.lang.Object object, java.lang.Class<? extends Command> 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 java.util.List<IItemPropertyDescriptor> itemPropertyDescriptors
This is used to store all the property descriptors. Derived classes should add descriptors to this vector.


childrenFeatures

protected java.util.List<EStructuralFeature> childrenFeatures
This is used to store all the children features. Derived classes should add features to this vector.


childrenReferences

@Deprecated
protected java.util.List<EReference> 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 java.util.List<Notifier> targets
This keeps track of all the targets to which this adapter is set.


childrenStoreMap

protected java.util.Map<java.lang.Object,ItemProviderAdapter.ChildrenStore> 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 java.lang.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

isResolveProxies

protected boolean isResolveProxies()
Returns whether proxies should be resolved when reflectively fetching values of features.

Since:
2.7

getValue

protected java.lang.Object getValue(EObject eObject,
                                    EStructuralFeature eStructuralFeature)
Returns the value of the feature. If proxies are not to be resolved they won't be, and in the case of a list value, a list that doesn't resolve proxies is returned.

Since:
2.7

isAdapterForType

public boolean isAdapterForType(java.lang.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
See Also:
AdapterFactory.isFactoryForType(java.lang.Object)

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 java.lang.Object getEditableValue(java.lang.Object object)
This implements IItemPropertySource.getEditableValue by simply returning the object itself.


getPropertyDescriptors

public java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.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(java.lang.Object object,
                                                     java.lang.Object propertyId)
This convenience method finds a particular descriptor given its ID or feature.


getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object object,
                                         java.lang.String property)
This implements a PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


isPropertySet

public boolean isPropertySet(java.lang.Object object,
                             java.lang.String property)
This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


resetPropertyValue

public void resetPropertyValue(java.lang.Object object,
                               java.lang.String property)
This implements PropertySource.resetPropertyValue by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


setPropertyValue

public void setPropertyValue(java.lang.Object object,
                             java.lang.String property,
                             java.lang.Object value)
This implements PropertySource by delegating to the descriptor, which is assumed to support the IItemPropertyDescriptor interface


getElements

public java.util.Collection<?> getElements(java.lang.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 java.util.Collection<?> getChildren(java.lang.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(java.lang.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 use the optimized approach offered by hasChildren(Object, boolean) (i.e. by passing true as the second argument).

See Also:
hasChildren(Object, boolean)

hasChildren

protected boolean hasChildren(java.lang.Object object,
                              boolean optimized)
This implements ITreeItemContentProvider.hasChildren. The approach taken depends on the value of optimized. The traditional, non-optimized approach simply tests whether whether getChildren returns any children. The new, optimized approach actually iterates through and tests the children features directly, avoiding accessing the children objects themselves, wherever possible.

Since:
2.4

getChildrenFeatures

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. 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

@Deprecated
protected java.util.Collection<? extends EReference> getChildrenReferences(java.lang.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 java.lang.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

@Deprecated
protected java.lang.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(java.lang.Object object,
                                             java.lang.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.


isValidValue

protected boolean isValidValue(java.lang.Object object,
                               java.lang.Object value,
                               EStructuralFeature feature)
This returns whether the given value is an appropriate instance for the given feature of the given object.


getChildReference

@Deprecated
protected EReference getChildReference(java.lang.Object object,
                                                  java.lang.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 java.util.Collection<? extends EStructuralFeature> getSetFeatures(java.lang.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(java.lang.Object object,
                                           java.lang.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 java.lang.Object getParent(java.lang.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 java.lang.Object getImage(java.lang.Object object)
This implements IItemLabelProvider.getImage by returning null. Most things really should have an icon, but not having one is technically correct too.


getColumnImage

public java.lang.Object getColumnImage(java.lang.Object object,
                                       int columnIndex)
This implements ITableItemLabelProvider.getColumnImage by returning null.


overlayImage

protected java.lang.Object overlayImage(java.lang.Object object,
                                        java.lang.Object image)
This adds an overlay to the given image if the object is controlled.


getText

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


getColumnText

public java.lang.String getColumnText(java.lang.Object object,
                                      int columnIndex)
This implements ITableItemLabelProvider.getColumnText by returning "".


getFont

public java.lang.Object getFont(java.lang.Object object)
This implements IItemFontProvider.getFont by returning null;


getFont

public java.lang.Object getFont(java.lang.Object object,
                                int columnIndex)
This implements ITableItemFontProvider.getFont by returning null;


getForeground

public java.lang.Object getForeground(java.lang.Object object)
This implements IItemColorProvider.getForeground by returning null;


getForeground

public java.lang.Object getForeground(java.lang.Object object,
                                      int columnIndex)
This implements ITableItemColorProvider.getForeground by returning null;


getBackground

public java.lang.Object getBackground(java.lang.Object object)
This implements IItemColorProvider.getBackground by returning null;


getBackground

public java.lang.Object getBackground(java.lang.Object object,
                                      int columnIndex)
This implements ITableItemColorProvider.getBackground by returning null;


getUpdateableText

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


crop

public java.lang.String crop(java.lang.String text)
This crops the given text to exclude any control characters. The first such character and all following it are replaced by "..."

Since:
2.2.0

getNewChildDescriptors

public java.util.Collection<?> getNewChildDescriptors(java.lang.Object object,
                                                      EditingDomain editingDomain,
                                                      java.lang.Object sibling)
This implements IEditingDomainItemProvider.getNewChildDescriptors, returning descriptors for all the possible children that can be added to the specified object. Usually, these descriptors will be instances of CommandParameters, containing at least the child object and the feature under which it should be added.

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(java.lang.Object value,
                                    java.lang.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(java.util.Collection<java.lang.Object> newChildDescriptors,
                                          java.lang.Object object)
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.


createCommand

public Command createCommand(java.lang.Object object,
                             EditingDomain domain,
                             java.lang.Class<? extends Command> commandClass,
                             CommandParameter commandParameter)
This implements delegated command creation for the given object.


createSetCommand

protected Command createSetCommand(EditingDomain domain,
                                   EObject owner,
                                   EStructuralFeature feature,
                                   java.lang.Object value,
                                   int index)
This creates a primitive SetCommand.


createSetCommand

protected Command createSetCommand(EditingDomain domain,
                                   EObject owner,
                                   EStructuralFeature feature,
                                   java.lang.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,
                                      java.util.Collection<?> collection)
This creates a primitive RemoveCommand.


createRemoveCommand

@Deprecated
protected Command createRemoveCommand(EditingDomain domain,
                                                 EObject owner,
                                                 EReference feature,
                                                 java.util.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,
                                       java.util.Collection<?> collection)
This creates a primitive ReplaceCommand.


createReplaceCommand

@Deprecated
protected Command createReplaceCommand(EditingDomain domain,
                                                  EObject owner,
                                                  EReference feature,
                                                  EObject value,
                                                  java.util.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,
                                   java.util.Collection<?> collection,
                                   int index)
This creates a primitive AddCommand.


createAddCommand

@Deprecated
protected Command createAddCommand(EditingDomain domain,
                                              EObject owner,
                                              EReference feature,
                                              java.util.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,
                                    java.lang.Object value,
                                    int index)
This creates a primitive MoveCommand.


createMoveCommand

@Deprecated
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,
                                           java.lang.Object owner,
                                           float location,
                                           int operations,
                                           int operation,
                                           java.util.Collection<?> collection)
This creates a primitive DragAndDropCommand.


createCreateChildCommand

protected Command createCreateChildCommand(EditingDomain domain,
                                           EObject owner,
                                           EStructuralFeature feature,
                                           java.lang.Object value,
                                           int index,
                                           java.util.Collection<?> collection)
This creates a primitive CreateChildCommand.


createCreateChildCommand

@Deprecated
protected Command createCreateChildCommand(EditingDomain domain,
                                                      EObject owner,
                                                      EReference feature,
                                                      EObject value,
                                                      int index,
                                                      java.util.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. This method is only to be called by a notifier when this adapter is added to or removed from its adapter list. In general, an adapter may be shared by more than one notifier.

Specified by:
setTarget in interface Adapter
Overrides:
setTarget in class AdapterImpl
Parameters:
target - the new notifier.
See Also:
Adapter.getTarget()

unsetTarget

public void unsetTarget(Notifier target)
Description copied from interface: Adapter.Internal
Unsets the target from which the adapter will receive notification. This method is only to be called by a notifier when this adapter is removed from its adapter list. In general, an adapter may be shared by more than one notifier, so this mechanism allows the adapter to know specifically which notifier will no longer be notifying.

Specified by:
unsetTarget in interface Adapter.Internal
Overrides:
unsetTarget in class AdapterImpl
Parameters:
target - the old notifier.
See Also:
Adapter.getTarget(), Adapter.setTarget(Notifier)

dispose

public void dispose()
This will remove this adapter from all its the targets and dispose any remaining children wrappers in the children store.

Specified by:
dispose in interface IDisposable

createChildParameter

protected CommandParameter createChildParameter(java.lang.Object feature,
                                                java.lang.Object child)
This is a convenience method that creates a CommandParameter for a given parent feature and child object.


getCreateChildResult

public java.util.Collection<?> getCreateChildResult(java.lang.Object child)
This returns the result collection for CreateChildCommand.

Specified by:
getCreateChildResult in interface CreateChildCommand.Helper

getCreateChildText

public 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.

Specified by:
getCreateChildText in interface CreateChildCommand.Helper

getCreateChildDescription

public java.lang.String getCreateChildDescription(java.lang.Object owner,
                                                  java.lang.Object feature,
                                                  java.lang.Object child,
                                                  java.util.Collection<?> selection)
This returns the description for CreateChildCommand.

Specified by:
getCreateChildDescription in interface CreateChildCommand.Helper

getCreateChildToolTipText

public java.lang.String getCreateChildToolTipText(java.lang.Object owner,
                                                  java.lang.Object feature,
                                                  java.lang.Object child,
                                                  java.util.Collection<?> selection)
This returns the tool tip text for CreateChildCommand.

Specified by:
getCreateChildToolTipText in interface CreateChildCommand.Helper

getCreateChildImage

public 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.

Specified by:
getCreateChildImage in interface CreateChildCommand.Helper

shouldComposeCreationImage

protected boolean shouldComposeCreationImage()
Indicates whether creation icon images should always be composed in getCreateChildImage(Object, Object, Object, Collection).

Since:
2.6

getTypeText

protected java.lang.String getTypeText(java.lang.Object object)
This looks up the name of the type of the specified object.


getTypeText

protected java.lang.String getTypeText(EAttribute attribute)
This looks up the name of the type of the specified attribute.


getFeatureText

protected java.lang.String getFeatureText(java.lang.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(java.lang.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 java.net.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 java.lang.Object getImage(java.lang.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.

shouldTranslate

protected boolean shouldTranslate()
Indicates whether strings should be translated by default.

Returns:
true if strings should be translated by default; false otherwise.

getString

public java.lang.String getString(java.lang.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 java.lang.String getString(java.lang.String key,
                                  boolean translate)
Get a translated string from the resource locator.

Specified by:
getString in interface ResourceLocator
Parameters:
key - the key of the string resource.
translate - whether the result is to be translated to the current locale.
Returns:
the string resource associated with the key.

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.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

public java.lang.String getString(java.lang.String key,
                                  java.lang.Object[] substitutions,
                                  boolean translate)
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.
translate - whether the result is to be translated to the current locale.
Returns:
a string resource associated with the key.
See Also:
ResourceLocator.getString(String), MessageFormat.format(String, Object[])

getString

protected java.lang.String getString(java.lang.String key,
                                     java.lang.String s0)
Get a translated string from the resource locator, substituting another such translated string.


getString

protected java.lang.String getString(java.lang.String key,
                                     java.lang.String s0,
                                     boolean translate)
Get a translated string from the resource locator, substituting another such translated string.


getString

protected java.lang.String getString(java.lang.String key,
                                     java.lang.String s0,
                                     java.lang.String s1)
Get a translated string from the resource locator, substituting two other such translated strings.


getString

protected java.lang.String getString(java.lang.String key,
                                     java.lang.String s0,
                                     java.lang.String s1,
                                     boolean translate)
Get a translated string from the resource locator, substituting two other such translated strings.


isWrappingNeeded

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. 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(java.lang.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(java.lang.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 java.lang.Object wrap(EObject object,
                                EStructuralFeature feature,
                                java.lang.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 original value is returned. Subclasses may override createWrapper to specify when and with what to wrap values.


createWrapper

protected java.lang.Object createWrapper(EObject object,
                                         EStructuralFeature feature,
                                         java.lang.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 java.lang.Object unwrap(java.lang.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(java.lang.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(java.util.List<?> objects)
Each element of the given list that implements IWrapperItemProvider is disposed by calling dispose and is removed from wrappers.


adjustWrapperIndex

protected void adjustWrapperIndex(java.lang.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(java.util.List<java.lang.Object> 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(java.util.List<java.lang.Object> 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,
                                               java.lang.Class<? extends Command> 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 is never unwrapped.


wrapCommand

protected Command wrapCommand(Command command,
                              java.lang.Object object,
                              java.lang.Class<? extends Command> 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 java.util.Collection<? extends IWrapperItemProvider> getWrappedValues(CommandParameter commandParameter)
Returns a collection of any objects in the given command parameter's collection and value, that implement IWrapperItemProvider.


createItemPropertyDescriptor

protected ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory,
                                                              ResourceLocator resourceLocator,
                                                              java.lang.String displayName,
                                                              java.lang.String description,
                                                              EStructuralFeature feature,
                                                              boolean isSettable,
                                                              java.lang.Object staticImage,
                                                              java.lang.String category,
                                                              java.lang.String[] filterFlags)
This creates an item provider descriptor that uses a resource locator; specifies a static image, a category, and filter flags; and determines the cell editor from the type of the structural feature.

Newly regenerated code will no longer use this method. You'll need to override this form instead.


createItemPropertyDescriptor

protected ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory,
                                                              ResourceLocator resourceLocator,
                                                              java.lang.String displayName,
                                                              java.lang.String description,
                                                              EStructuralFeature feature,
                                                              boolean isSettable,
                                                              boolean multiLine,
                                                              boolean sortChoices,
                                                              java.lang.Object staticImage,
                                                              java.lang.String category,
                                                              java.lang.String[] filterFlags)
Creates an instance that uses a resource locator; indicates whether to be multi-line and to sort choices; specifies a static image, a category, and filter flags; and determines the cell editor from the type of the structural feature.

Since:
2.2.0

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