org.eclipse.emf.edit.provider
Class WrapperItemProvider.WrapperItemPropertyDescriptor

java.lang.Object
  extended by org.eclipse.emf.edit.provider.ItemPropertyDescriptor
      extended by org.eclipse.emf.edit.provider.WrapperItemProvider.WrapperItemPropertyDescriptor
All Implemented Interfaces:
IItemPropertyDescriptor, IItemPropertyDescriptor.OverrideableCommandOwner
Enclosing class:
WrapperItemProvider

protected class WrapperItemProvider.WrapperItemPropertyDescriptor
extends ItemPropertyDescriptor

An item property descriptor for the single property of a wrapper for a simple value. This extends the base implementation and substitutes the wrapper's owner for the selected object (the wrapper itself) in the call to getPropertyValue. Thus, the owner must be an EObject to use this class. The property's name, description, settable flag, static image, category, and filter flags are obtained by calling out to various template methods, so can be easily changed by deriving a subclass.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.provider.ItemPropertyDescriptor
ItemPropertyDescriptor.ItemDelegator, ItemPropertyDescriptor.PropertyValueWrapper
 
Nested classes/interfaces inherited from interface org.eclipse.emf.edit.provider.IItemPropertyDescriptor
IItemPropertyDescriptor.OverrideableCommandOwner
 
Field Summary
 
Fields inherited from class org.eclipse.emf.edit.provider.ItemPropertyDescriptor
adapterFactory, BOOLEAN_VALUE_IMAGE, category, commandOwner, description, displayName, ecorePackage, feature, filterFlags, GENERIC_VALUE_IMAGE, INTEGRAL_VALUE_IMAGE, isSettable, itemDelegator, multiLine, parentReferences, REAL_VALUE_IMAGE, resourceLocator, sortChoices, staticImage, TEXT_VALUE_IMAGE
 
Constructor Summary
WrapperItemProvider.WrapperItemPropertyDescriptor(ResourceLocator resourceLocator, EStructuralFeature feature)
           
 
Method Summary
 boolean canSetProperty(java.lang.Object object)
          Substitutes the wrapper owner for the selected object and invokes the base implementation.
protected  Command createSetCommand(EditingDomain domain, java.lang.Object owner, java.lang.Object feature, java.lang.Object value)
          Returns a command that will set the value on the model object.
 java.util.Collection<?> getChoiceOfValues(java.lang.Object object)
          Substitutes the wrapper owner for the selected object and invokes the base implementation.
 java.lang.Object getPropertyValue(java.lang.Object object)
          Substitutes the wrapper owner for the selected object and invokes the base implementation.
protected  java.lang.Object getValue(EObject object, EStructuralFeature feature)
          Returns a value from a model object.
 boolean isMany(java.lang.Object object)
          Returns false, as the property only represents a single value, even if the feature is multi-valued.
 boolean isPropertySet(java.lang.Object object)
          Returns true, as the property of a value wrapper is always considered to be set.
 void resetPropertyValue(java.lang.Object object)
          Does nothing, as resetting the property of a value wrapper is not meaningful.
 void setPropertyValue(java.lang.Object object, java.lang.Object value)
          Sets the property value.
protected  void setValue(EObject object, EStructuralFeature feature, java.lang.Object value)
          Sets a value on a model object.
 
Methods inherited from class org.eclipse.emf.edit.provider.ItemPropertyDescriptor
collectReachableObjectsOfType, createPropertyValueWrapper, getCategory, getComboBoxObjects, getCommandOwner, getCommandOwner, getDefaultId, getDefaultValue, getDescription, getDisplayName, getEditingDomain, getFeature, getFilterFlags, getHelpContextIds, getId, getLabelProvider, getReachableObjectsOfType, isCompatibleWith, isMultiLine, isSortChoices, setCommandOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrapperItemProvider.WrapperItemPropertyDescriptor

public WrapperItemProvider.WrapperItemPropertyDescriptor(ResourceLocator resourceLocator,
                                                         EStructuralFeature feature)
Method Detail

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object object)
Substitutes the wrapper owner for the selected object and invokes the base implementation. The actual value returned depends on the implementation of getValue.

Specified by:
getPropertyValue in interface IItemPropertyDescriptor
Overrides:
getPropertyValue in class ItemPropertyDescriptor

canSetProperty

public boolean canSetProperty(java.lang.Object object)
Substitutes the wrapper owner for the selected object and invokes the base implementation.

Specified by:
canSetProperty in interface IItemPropertyDescriptor
Overrides:
canSetProperty in class ItemPropertyDescriptor

isPropertySet

public boolean isPropertySet(java.lang.Object object)
Returns true, as the property of a value wrapper is always considered to be set.

Specified by:
isPropertySet in interface IItemPropertyDescriptor
Overrides:
isPropertySet in class ItemPropertyDescriptor

resetPropertyValue

public void resetPropertyValue(java.lang.Object object)
Does nothing, as resetting the property of a value wrapper is not meaningful.

Specified by:
resetPropertyValue in interface IItemPropertyDescriptor
Overrides:
resetPropertyValue in class ItemPropertyDescriptor

setPropertyValue

public void setPropertyValue(java.lang.Object object,
                             java.lang.Object value)
Sets the property value. If an editing domain can be obtained, the command returned by createSetcommand is executed; otherwise, setValue is called to set the value.

Specified by:
setPropertyValue in interface IItemPropertyDescriptor
Overrides:
setPropertyValue in class ItemPropertyDescriptor

getValue

protected java.lang.Object getValue(EObject object,
                                    EStructuralFeature feature)
Returns a value from a model object. If the feature is multi-valued, only the single value that the wrapper represents is returned.

Overrides:
getValue in class ItemPropertyDescriptor

setValue

protected void setValue(EObject object,
                        EStructuralFeature feature,
                        java.lang.Object value)
Sets a value on a model object. If the feature is multi-valued, only the single value that the wrapper represents is set.


createSetCommand

protected Command createSetCommand(EditingDomain domain,
                                   java.lang.Object owner,
                                   java.lang.Object feature,
                                   java.lang.Object value)
Returns a command that will set the value on the model object. The wrapper is used as the owner of the command, unless overridden, so that it can specialize the command that eventually gets created.


isMany

public boolean isMany(java.lang.Object object)
Returns false, as the property only represents a single value, even if the feature is multi-valued.

Specified by:
isMany in interface IItemPropertyDescriptor
Overrides:
isMany in class ItemPropertyDescriptor

getChoiceOfValues

public java.util.Collection<?> getChoiceOfValues(java.lang.Object object)
Substitutes the wrapper owner for the selected object and invokes the base implementation.

Specified by:
getChoiceOfValues in interface IItemPropertyDescriptor
Overrides:
getChoiceOfValues in class ItemPropertyDescriptor

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