org.eclipse.emf.edit.provider
Class FeatureMapEntryWrapperItemProvider

java.lang.Object
  extended by org.eclipse.emf.edit.provider.WrapperItemProvider
      extended by org.eclipse.emf.edit.provider.DelegatingWrapperItemProvider
          extended by org.eclipse.emf.edit.provider.FeatureMapEntryWrapperItemProvider
All Implemented Interfaces:
IChangeNotifier, IDisposable, IEditingDomainItemProvider, IItemColorProvider, IItemFontProvider, IItemLabelProvider, IItemPropertySource, INotifyChangedListener, IStructuredItemContentProvider, ITableItemColorProvider, ITableItemFontProvider, ITableItemLabelProvider, ITreeItemContentProvider, IWrapperItemProvider

public class FeatureMapEntryWrapperItemProvider
extends DelegatingWrapperItemProvider

A wrapper for FeatureMap.Entrys. Feature map entry values can be either simple attribute values or model objects, so this wrapper provides behaviours appropriate for both, depending on the type of the entry feature. If it is a reference with a non-null value, an item provider will be obtained for that value, and most methods will delegate to that item provider. Otherwise, simple attribute-value-like implementations generally suffice. This wrapper's text and image values reflect the primary use of feature maps: to represent XML mixed content and choice model groups.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.provider.DelegatingWrapperItemProvider
DelegatingWrapperItemProvider.AffectedObjectsWrappingCommand, DelegatingWrapperItemProvider.AffectedObjectsWrappingCommandActionDelegate, DelegatingWrapperItemProvider.DelegatingWrapperItemPropertyDescriptor
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
WrapperItemProvider.ReplacementAffectedObjectCommand, WrapperItemProvider.SimpleCopyCommand, WrapperItemProvider.WrapperItemPropertyDescriptor, WrapperItemProvider.WrappingCopyCommand
 
Field Summary
protected  ResourceLocator resourceLocator
          The resource locator from the owner's item provider.
 
Fields inherited from class org.eclipse.emf.edit.provider.DelegatingWrapperItemProvider
changeNotifier, childrenMap, delegateChildren, delegateItemProvider, propertyDescriptors
 
Fields inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
adapterFactory, COPY_COMMAND_DESCRIPTION, COPY_COMMAND_LABEL, feature, index, owner, value
 
Fields inherited from interface org.eclipse.emf.edit.provider.IItemFontProvider
BOLD_FONT, BOLD_ITALIC_FONT, ITALIC_FONT, NORMAL_FONT
 
Fields inherited from interface org.eclipse.emf.edit.provider.IItemColorProvider
GRAYED_OUT_COLOR
 
Constructor Summary
FeatureMapEntryWrapperItemProvider(FeatureMap.Entry entry, EObject owner, EAttribute attribute, int index, AdapterFactory adapterFactory)
          Deprecated. As of EMF 2.0.1, replaced by this form.
FeatureMapEntryWrapperItemProvider(FeatureMap.Entry entry, EObject owner, EAttribute attribute, int index, AdapterFactory adapterFactory, ResourceLocator resourceLocator)
          Creates an instance for the feature map entry.
 
Method Summary
protected  java.lang.String addEntryFeature(java.lang.String text)
          Prepends the entry feature name to the given text and returns the result.
 Command createCommand(java.lang.Object object, EditingDomain domain, java.lang.Class<? extends Command> commandClass, CommandParameter commandParameter)
          Uses the delegate item provider or the base wrapper implementation to create a command.
protected  Command createCopyCommand(EditingDomain domain, java.lang.Object owner, CopyCommand.Helper helper)
          This is only called for null or attribute values; it returns a WrapperItemProvider.SimpleCopyCommand that copies the wrapper.
protected  Command createSetCommand(EditingDomain domain, java.lang.Object owner, java.lang.Object feature, java.lang.Object value, int index)
          Returns a wrapped set command that returns as its affected object the replacement wrapper for the value.
protected  java.lang.String decode(java.lang.String s)
          Decodes the given string by replacing any occurrences Java escape sequences to actual characters.
protected  java.lang.String encode(java.lang.String s)
          Encodes the given string by replacing any occurrences of non-printable characters by the corresponding Java escape sequence.
protected  java.lang.Object getDelegateValue()
          If the entry's feature is a reference, returns its value as the value from which to obtain and which to pass to a delegate item provider.
 java.lang.Object getEditableValue(java.lang.Object object)
          Uses the delegate item provider for a reference value or returns the attribute value itself.
protected  EStructuralFeature getEntryFeature()
          Returns the feature of the wrapped feature map entry.
protected  java.lang.Object getEntryValue()
          Returns the value of the wrapped feature map entry.
 java.lang.Object getImage(java.lang.Object object)
          Returns the appropriate image for the entry value: the text property icon for text, CDATA, or comment; the generic property icon for an attribute value; the generic item icon for a null reference value; or the icon returned by the delegate item provider for a non-null reference value.
 java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
          Uses the delegate item provider for a reference value or creates a single property descriptor for an attribute value.
protected  java.lang.Object getPropertyImage()
          Calls getPropertyImage to obtain the property image for the entry attribute's type.
 java.lang.String getText(java.lang.Object object)
          Returns the appropriate text for the entry value.
protected  boolean isEntryAttribute()
          Returns whether the feature of the wrapped feature map entry is an attribute.
protected  boolean isPropertySettable()
          Returns whether the entry attribute is changeable.
protected  Command wrapCommand(Command command, java.lang.Class<? extends Command> commandClass)
          For a copy command, creates a WrapperItemProvider.WrappingCopyCommand, which copies the feature map entry and wrapper along with the entry value; for other commands, the wrapper-substituting command wrapper supplied by the base implementation is used.
 
Methods inherited from class org.eclipse.emf.edit.provider.DelegatingWrapperItemProvider
addListener, createWrapper, dispose, fireNotifyChanged, getBackground, getBackground, getChildren, getColumnImage, getColumnText, getElements, getFont, getFont, getForeground, getForeground, getNewChildDescriptors, getRefreshElement, hasChildren, notifyChanged, removeListener, updateChildren, wrapNotification
 
Methods inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
baseCreateCommand, createDragAndDropCommand, getFeature, getIndex, getOwner, getParent, getPropertyCategory, getPropertyDescription, getPropertyDescriptor, getPropertyFilterFlags, getPropertyImage, getPropertyName, getRootAdapterFactory, getUpdateableText, getValue, isPropertyMultiLine, isPropertySortChoices, setIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.edit.provider.ITreeItemContentProvider
getParent
 
Methods inherited from interface org.eclipse.emf.edit.provider.IItemPropertySource
getPropertyDescriptor
 
Methods inherited from interface org.eclipse.emf.edit.provider.IEditingDomainItemProvider
getParent
 

Field Detail

resourceLocator

protected ResourceLocator resourceLocator
The resource locator from the owner's item provider.

Constructor Detail

FeatureMapEntryWrapperItemProvider

public FeatureMapEntryWrapperItemProvider(FeatureMap.Entry entry,
                                          EObject owner,
                                          EAttribute attribute,
                                          int index,
                                          AdapterFactory adapterFactory,
                                          ResourceLocator resourceLocator)
Creates an instance for the feature map entry. If the entry's feature is a reference, a delegate item provider is created and set up to repeat notifications, decorating them, so that they will update this wrapper, rather than the model object they originate from. If the entry's feature is an attribute or a null reference, no delegate will be created.

Throws:
java.lang.IllegalArgumentException - If the specified feature map entry is null.

FeatureMapEntryWrapperItemProvider

@Deprecated
public FeatureMapEntryWrapperItemProvider(FeatureMap.Entry entry,
                                                     EObject owner,
                                                     EAttribute attribute,
                                                     int index,
                                                     AdapterFactory adapterFactory)
Deprecated. As of EMF 2.0.1, replaced by this form.

Creates an instance for the feature map entry. If the entry's feature is not a reference, the item property descriptor that will be created for the value should get a resource. So, this constructor has been deprecated.

Throws:
java.lang.IllegalArgumentException - If the specified feature map entry is null.
Method Detail

getEntryValue

protected java.lang.Object getEntryValue()
Returns the value of the wrapped feature map entry.


getEntryFeature

protected EStructuralFeature getEntryFeature()
Returns the feature of the wrapped feature map entry.


isEntryAttribute

protected boolean isEntryAttribute()
Returns whether the feature of the wrapped feature map entry is an attribute.


getDelegateValue

protected java.lang.Object getDelegateValue()
If the entry's feature is a reference, returns its value as the value from which to obtain and which to pass to a delegate item provider. If the entry's feature is an attribute, null is returned.

Overrides:
getDelegateValue in class DelegatingWrapperItemProvider

getText

public java.lang.String getText(java.lang.Object object)
Returns the appropriate text for the entry value. If the entry represents XML text, CDATA, or comment, it is appropriately decorated and encoded to remove non-printable characters. Otherwise, the feature name is prepended to the text returned by the item provider decorator, for a reference value, or the factory method, for an attribute value.

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

addEntryFeature

protected java.lang.String addEntryFeature(java.lang.String text)
Prepends the entry feature name to the given text and returns the result.


getImage

public java.lang.Object getImage(java.lang.Object object)
Returns the appropriate image for the entry value: the text property icon for text, CDATA, or comment; the generic property icon for an attribute value; the generic item icon for a null reference value; or the icon returned by the delegate item provider for a non-null reference value.

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

encode

protected java.lang.String encode(java.lang.String s)
Encodes the given string by replacing any occurrences of non-printable characters by the corresponding Java escape sequence.


decode

protected java.lang.String decode(java.lang.String s)
Decodes the given string by replacing any occurrences Java escape sequences to actual characters.


getPropertyDescriptors

public java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
Uses the delegate item provider for a reference value or creates a single property descriptor for an attribute value.

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

getEditableValue

public java.lang.Object getEditableValue(java.lang.Object object)
Uses the delegate item provider for a reference value or returns the attribute value itself.

Specified by:
getEditableValue in interface IItemPropertySource
Overrides:
getEditableValue in class DelegatingWrapperItemProvider

isPropertySettable

protected boolean isPropertySettable()
Returns whether the entry attribute is changeable.

Overrides:
isPropertySettable in class WrapperItemProvider

getPropertyImage

protected java.lang.Object getPropertyImage()
Calls getPropertyImage to obtain the property image for the entry attribute's type.

Overrides:
getPropertyImage in class WrapperItemProvider

createCommand

public Command createCommand(java.lang.Object object,
                             EditingDomain domain,
                             java.lang.Class<? extends Command> commandClass,
                             CommandParameter commandParameter)
Uses the delegate item provider or the base wrapper implementation to create a command.

Specified by:
createCommand in interface IEditingDomainItemProvider
Overrides:
createCommand in class DelegatingWrapperItemProvider

wrapCommand

protected Command wrapCommand(Command command,
                              java.lang.Class<? extends Command> commandClass)
For a copy command, creates a WrapperItemProvider.WrappingCopyCommand, which copies the feature map entry and wrapper along with the entry value; for other commands, the wrapper-substituting command wrapper supplied by the base implementation is used. This method is only called for non-null reference values to wrap a command returned by the delegate item provider.

Overrides:
wrapCommand in class DelegatingWrapperItemProvider

createSetCommand

protected Command createSetCommand(EditingDomain domain,
                                   java.lang.Object owner,
                                   java.lang.Object feature,
                                   java.lang.Object value,
                                   int index)
Returns a wrapped set command that returns as its affected object the replacement wrapper for the value. A feature map entry is also created for the value, and used as the value of the set command.

Overrides:
createSetCommand in class WrapperItemProvider

createCopyCommand

protected Command createCopyCommand(EditingDomain domain,
                                    java.lang.Object owner,
                                    CopyCommand.Helper helper)
This is only called for null or attribute values; it returns a WrapperItemProvider.SimpleCopyCommand that copies the wrapper.

Overrides:
createCopyCommand in class WrapperItemProvider

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