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 FeatureMapEntryWrapperItemProvider

java.lang.Object
  extended byorg.eclipse.emf.edit.provider.WrapperItemProvider
      extended byorg.eclipse.emf.edit.provider.DelegatingWrapperItemProvider
          extended byorg.eclipse.emf.edit.provider.FeatureMapEntryWrapperItemProvider

All Implemented Interfaces:
IChangeNotifier, IDisposable, IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, INotifyChangedListener, IStructuredItemContentProvider, 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 inherited from class org.eclipse.emf.edit.provider.DelegatingWrapperItemProvider
DelegatingWrapperItemProvider.AffectedObjectsWrappingCommand, DelegatingWrapperItemProvider.AffectedObjectsWrappingCommandActionDelegate
 
Nested classes inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
WrapperItemProvider.SimpleCopyCommand, WrapperItemProvider.WrappingCopyCommand
 
Field Summary
protected  EAttribute attribute
          The attribute through which the feature map entry can be set and retreived.
protected  int index
          The index within the attribute at which the feature map entry is located.
 
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, owner, value
 
Constructor Summary
FeatureMapEntryWrapperItemProvider(FeatureMap.Entry entry, EObject owner, EAttribute attribute, int index, AdapterFactory adapterFactory)
          Creates an instance for the feature map entry.
 
Method Summary
protected  String addEntryFeature(String text)
          Prepends the entry feature name to the given text and returns the result.
 Command createCommand(Object object, EditingDomain domain, Class commandClass, CommandParameter commandParameter)
          Uses the delegate item provider or the base wrapper implementation to create a command.
protected  Command createCopyCommand(EditingDomain domain, Object owner, CopyCommand.Helper helper)
          This is only called for null or attribute values; it returns a WrapperItemProvider.SimpleCopyCommand that copies the wrapper.
protected  String encode(String s)
          Encodes the given string by replacing any occurences of non-printable characters by the corresponding Java escape sequence.
protected  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.
 Object getEditableValue(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  Object getEntryValue()
          Returns the value of the wrapped feature map entry.
 Object getImage(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.
 int getIndex()
          Returns the index within the attribute at which the feature map entry is located.
 List getPropertyDescriptors(Object object)
          Uses the delegate item provider for a reference value or creates a single property descriptor for an attribute value, calling out to getPropertyName, getPropertyDescription, isPropertySettable, and getPropertyImage.
protected  Object getPropertyImage()
          Calls getPropertyImage to obtain the property image for the entry attribute's type.
 String getText(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 false, since the property descriptor decorator cannot properly set the feature map entry value.
 void setIndex(int index)
          Sets the index.
protected  Command wrapCommand(Command command, Class 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, getChildren, getElements, getNewChildDescriptors, getRefreshElement, hasChildren, notifyChanged, removeListener, updateChildren, wrapNotification
 
Methods inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
baseCreateCommand, createDragAndDropCommand, getParent, getPropertyDescription, getPropertyDescriptor, getPropertyImage, getPropertyName, getRootAdapterFactory, getUpdateableText, getValue
 
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

 

 

attribute

protected EAttribute attribute

The attribute through which the feature map entry can be set and retreived.


 

 

index

protected int index

The index within the attribute at which the feature map entry is located.

Constructor Detail

 

 

FeatureMapEntryWrapperItemProvider

public FeatureMapEntryWrapperItemProvider(FeatureMap.Entry entry,
                                          EObject owner,
                                          EAttribute attribute,
                                          int index,
                                          AdapterFactory adapterFactory)

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:
IllegalArgumentException - If the specified feature map entry is null.
Method Detail

 

 

getEntryValue

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


 

 

getIndex

public int getIndex()

Returns the index within the attribute at which the feature map entry is located.

Specified by:
getIndex in interface IWrapperItemProvider
Overrides:
getIndex in class WrapperItemProvider


 

 

setIndex

public void setIndex(int index)

Sets the index.

Specified by:
setIndex in interface IWrapperItemProvider
Overrides:
setIndex in class WrapperItemProvider


 

 

getText

public String getText(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 String addEntryFeature(String text)

Prepends the entry feature name to the given text and returns the result.


 

 

getImage

public Object getImage(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 String encode(String s)

Encodes the given string by replacing any occurences of non-printable characters by the corresponding Java escape sequence.


 

 

getPropertyDescriptors

public List getPropertyDescriptors(Object object)

Uses the delegate item provider for a reference value or creates a single property descriptor for an attribute value, calling out to getPropertyName, getPropertyDescription, isPropertySettable, and getPropertyImage.

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


 

 

getEditableValue

public Object getEditableValue(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 false, since the property descriptor decorator cannot properly set the feature map entry value.

Overrides:
isPropertySettable in class WrapperItemProvider


 

 

getPropertyImage

protected Object getPropertyImage()

Calls getPropertyImage to obtain the property image for the entry attribute's type.

Overrides:
getPropertyImage in class WrapperItemProvider


 

 

createCommand

public Command createCommand(Object object,
                             EditingDomain domain,
                             Class 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,
                              Class 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


 

 

createCopyCommand

protected Command createCopyCommand(EditingDomain domain,
                                    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


 

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