org.eclipse.emf.edit.provider
Class AttributeValueWrapperItemProvider

java.lang.Object
  extended byorg.eclipse.emf.edit.provider.WrapperItemProvider
      extended byorg.eclipse.emf.edit.provider.AttributeValueWrapperItemProvider
All Implemented Interfaces:
IDisposable, IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider, IWrapperItemProvider

public class AttributeValueWrapperItemProvider
extends WrapperItemProvider
implements IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IEditingDomainItemProvider

A wrapper implementation for simple attribute values.


Nested Class Summary
 
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 value can be set and retrieved.
protected  int index
          The index within the feature at which the value is located.
protected  List propertyDescriptors
          The single property descriptor for the value is cached here as a singleton list.
 
Fields inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
adapterFactory, COPY_COMMAND_DESCRIPTION, COPY_COMMAND_LABEL, owner, value
 
Constructor Summary
AttributeValueWrapperItemProvider(Object value, EObject owner, EAttribute attribute, AdapterFactory adapterFactory)
          Creates an instance for a single-valued attribute.
AttributeValueWrapperItemProvider(Object value, EObject owner, EAttribute attribute, int index, AdapterFactory adapterFactory)
          Creates an instance for a value within a multi-valued attribute.
 
Method Summary
protected  Command createCopyCommand(EditingDomain domain, Object owner, CopyCommand.Helper helper)
          Returns a WrapperItemProvider.SimpleCopyCommand that copies the value by converting it into a string and back, using the factory methods.
 int getIndex()
          Returns the index within the attribute at which the value is located.
 List getPropertyDescriptors(Object object)
          Creates, caches and returns a property descriptor decorator for the attribute of the owner.
protected  Object getPropertyImage()
          Calls getPropertyImage to obtain the property image for the attribute's type.
 String getText(Object object)
          If non-null, the value is converted to a string, using the type of its attribute and the appropriate factory.
protected  boolean isPropertySettable()
          Returns whether the attribute is changeable.
 void setIndex(int index)
          Sets the index.
 
Methods inherited from class org.eclipse.emf.edit.provider.WrapperItemProvider
baseCreateCommand, createCommand, createDragAndDropCommand, dispose, getChildren, getEditableValue, getElements, getImage, getNewChildDescriptors, getParent, getPropertyDescription, getPropertyDescriptor, getPropertyImage, getPropertyName, getRootAdapterFactory, getUpdateableText, getValue, hasChildren
 
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.IStructuredItemContentProvider
getElements
 
Methods inherited from interface org.eclipse.emf.edit.provider.ITreeItemContentProvider
getChildren, getParent, hasChildren
 
Methods inherited from interface org.eclipse.emf.edit.provider.IItemLabelProvider
getImage
 
Methods inherited from interface org.eclipse.emf.edit.provider.IItemPropertySource
getEditableValue, getPropertyDescriptor
 
Methods inherited from interface org.eclipse.emf.edit.provider.IEditingDomainItemProvider
createCommand, getChildren, getNewChildDescriptors, getParent
 

Field Detail

attribute

protected EAttribute attribute
The attribute through which the value can be set and retrieved.


index

protected int index
The index within the feature at which the value is located.


propertyDescriptors

protected List propertyDescriptors
The single property descriptor for the value is cached here as a singleton list.

Constructor Detail

AttributeValueWrapperItemProvider

public AttributeValueWrapperItemProvider(Object value,
                                         EObject owner,
                                         EAttribute attribute,
                                         AdapterFactory adapterFactory)
Creates an instance for a single-valued attribute.


AttributeValueWrapperItemProvider

public AttributeValueWrapperItemProvider(Object value,
                                         EObject owner,
                                         EAttribute attribute,
                                         int index,
                                         AdapterFactory adapterFactory)
Creates an instance for a value within a multi-valued attribute.

Method Detail

getIndex

public int getIndex()
Returns the index within the attribute at which the value 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)
If non-null, the value is converted to a string, using the type of its attribute and the appropriate factory.

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

getPropertyDescriptors

public List getPropertyDescriptors(Object object)
Creates, caches and returns a property descriptor decorator for the attribute of the owner. Calls out to getPropertyName, getPropertyDescription, isPropertySettable, and getPropertyImage, giving subclasses an opportunity to override them and control these aspects of the property.

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

isPropertySettable

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

Overrides:
isPropertySettable in class WrapperItemProvider

getPropertyImage

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

Overrides:
getPropertyImage in class WrapperItemProvider

createCopyCommand

protected Command createCopyCommand(EditingDomain domain,
                                    Object owner,
                                    CopyCommand.Helper helper)
Returns a WrapperItemProvider.SimpleCopyCommand that copies the value by converting it into a string and back, using the factory methods.

Overrides:
createCopyCommand in class WrapperItemProvider

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