org.eclipse.emf.mapping.provider
Class MappingItemProvider

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.emf.edit.provider.ItemProviderAdapter
          extended by org.eclipse.emf.mapping.provider.MappingItemProviderAdapter
              extended by org.eclipse.emf.mapping.provider.MappingItemProvider
All Implemented Interfaces:
Adapter, Adapter.Internal, ResourceLocator, CreateChildCommand.Helper, IChangeNotifier, IDisposable, IEditingDomainItemProvider, IItemLabelProvider, IItemPropertySource, IStructuredItemContentProvider, ITreeItemContentProvider
Direct Known Subclasses:
MappingRootItemProvider

public class MappingItemProvider
extends MappingItemProviderAdapter
implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource

This is the item provider adpater for a Mapping object.


Nested Class Summary
static class MappingItemProvider.TypeMappingHelperWrapper
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
ItemProviderAdapter.ChildrenStore, ItemProviderAdapter.ModifiableSingletonEList<E>, ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommand, ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommandActionDelegate
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
Adapter.Internal
 
Field Summary
protected static java.lang.String DIVIDER
           
protected  java.util.ArrayList<MappedObjectItemProvider> mappedObjectItemProviderList
           
protected static java.lang.String SEPARATOR
           
 
Fields inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
adapterFactory, changeNotifier, childrenFeatures, childrenReferences, childrenStoreMap, itemPropertyDescriptors, targets, wrappers, wrappingNeeded
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
MappingItemProvider(AdapterFactory adapterFactory)
          This constructs an instance from a factory and a notifier.
 
Method Summary
protected  Command createAddCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.util.Collection<?> collection, int index)
          This creates a primitive AddCommand.
 Command createCommand(java.lang.Object object, EditingDomain editingDomain, java.lang.Class<? extends Command> commandClass, CommandParameter commandParameter)
          This implements delegated command creation for the given object.
protected  Command createMoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, EObject value, int index)
          This creates a primitive MoveCommand.
protected  Command createNameMatchMappingCommand(MappingDomain domain, Mapping mapping)
          This creates a primitive NameMatchMappingCommand.
protected  Command createRemoveCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.util.Collection<?> collection)
          This creates a primitive RemoveCommand.
protected  Command createSetCommand(EditingDomain domain, EObject owner, EStructuralFeature feature, java.lang.Object value)
          This creates a primitive SetCommand.
protected  Command createTypeMatchMappingCommand(MappingDomain domain, Mapping mapping)
          This creates a primitive TypeMatchMappingCommand.
static java.util.Iterator<?> createValueIterator(java.lang.Object object)
           
 void dispose()
          This will remove this adapter from all its the targets and dispose any remaining children wrappers in the children store.
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  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.
 java.util.Collection<?> getChildren(java.lang.Object object)
          This implements ITreeItemContentProvider.getChildren.
 java.util.Collection<? extends EStructuralFeature> getChildrenFeatures(java.lang.Object object)
          This specifies how to implement getChildren(java.lang.Object) and is used to deduce an appropriate feature for an AddCommand, RemoveCommand or MoveCommand in createCommand(java.lang.Object, org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class, org.eclipse.emf.edit.command.CommandParameter).
static java.lang.Object getImage(MappingRoot mappingRoot, java.lang.String prefix, java.util.Collection<?> collection)
           
static java.lang.Object getImage(MappingRoot mappingRoot, java.lang.String prefix, java.util.Collection<?> collection, boolean supportNone)
           
 java.lang.Object getImage(java.lang.Object object)
          This returns Mapping.gif.
static java.lang.Object getImage(java.lang.String prefix, java.util.Collection<?> tops, java.util.Collection<?> bottoms)
           
static java.lang.Object getImage(java.lang.String prefix, java.util.Collection<?> tops, java.util.Collection<?> bottoms, boolean supportNone)
           
static java.lang.Object getImage(java.lang.String prefix, int topsSize, int bottomsSize, boolean supportNone)
           
protected  MappedObjectItemProvider getMappedObjectItemProvider(Mapping mapping, java.lang.Object mappedObject)
           
 java.lang.Object getParent(java.lang.Object object)
          This returns the nestedIn of the Mapping.
 java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
          This returns the property descriptors for the adapted class.
 void getPropertyDescriptorsForHelper(Mapping mapping)
           
 ResourceLocator getResourceLocator()
          Return the resource locator for this item provider's resources
 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.
static java.lang.String getText(MappingRoot mappingRoot, AdapterFactory adapterFactory, java.util.Collection<?> collection)
           
static java.lang.String getText(MappingRoot mappingRoot, AdapterFactory adapterFactory, java.util.Collection<?> inputs, java.util.Collection<?> outputs)
           
static java.lang.String getText(MappingRoot mappingRoot, AdapterFactory adapterFactory, java.util.Collection<?> inputs, java.util.Collection<?> outputs, java.lang.String objectSeparator, java.lang.String divider)
           
static java.lang.String getText(MappingRoot mappingRoot, AdapterFactory adapterFactory, java.util.Collection<?> collection, java.lang.String pathSeparator)
           
static java.lang.String getText(MappingRoot mappingRoot, AdapterFactory adapterFactory, java.util.Collection<?> collection, java.lang.String pathSeparator, java.lang.String objectSeparator, java.lang.String divider)
           
 java.lang.String getText(java.lang.Object object)
          This implements IItemLabelProvider.getText by simply calling toString on the argument.
 boolean hasChildren(java.lang.Object object)
          This implements ITreeItemContentProvider.hasChildren by simply testing whether getChildren returns any children.
 void notifyChanged(Notification msg)
          This handles notification by delegating to fireNotifyChanged.
protected  java.lang.Object substituteMappedObject(Mapping mapping, java.lang.Object object)
           
protected  java.lang.Object substituteMappedObjectItemProvider(Mapping mapping, java.lang.Object object)
           
 
Methods inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
addListener, adjustWrapperIndex, adjustWrapperIndices, adjustWrapperIndices, collectNewChildDescriptors, createAddCommand, createChildParameter, createChildrenStore, createCopyCommand, createCreateChildCommand, createCreateChildCommand, createCreateCopyCommand, createDragAndDropCommand, createInitializeCopyCommand, createItemPropertyDescriptor, createItemPropertyDescriptor, createMoveCommand, createMoveCommand, createRemoveCommand, createReplaceCommand, createReplaceCommand, createSetCommand, createWrapper, crop, disposeWrapper, disposeWrappers, factorMoveCommand, factorRemoveCommand, fireNotifyChanged, getAdapterFactory, getBackground, getBackground, getBaseURL, getChildReference, getChildrenReferences, getChildrenStore, getColumnImage, getColumnText, getCreateChildDescription, getCreateChildImage, getCreateChildResult, getCreateChildText, getCreateChildToolTipText, getEditableValue, getElements, getFeatureText, getFeatureValue, getFont, getFont, getForeground, getForeground, getImage, getNewChildDescriptors, getPropertyDescriptor, getPropertyValue, getReferenceValue, getResourceLocator, getRootAdapterFactory, getSetFeatures, getString, getString, getString, getString, getString, getString, getString, getString, getTypeText, getTypeText, getUpdateableText, getWrappedValues, hasChildren, isAdapterForType, isEquivalentValue, isPropertySet, isValidValue, isWrappingNeeded, overlayImage, removeListener, resetPropertyValue, setPropertyValue, setTarget, shouldTranslate, unsetTarget, unwrap, unwrapCommandValues, updateChildren, wrap, wrapCommand
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget
 
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.IEditingDomainItemProvider
getNewChildDescriptors
 
Methods inherited from interface org.eclipse.emf.edit.provider.IItemPropertySource
getEditableValue, getPropertyDescriptor
 

Field Detail

mappedObjectItemProviderList

protected java.util.ArrayList<MappedObjectItemProvider> mappedObjectItemProviderList

DIVIDER

protected static final java.lang.String DIVIDER

SEPARATOR

protected static final java.lang.String SEPARATOR
Constructor Detail

MappingItemProvider

public MappingItemProvider(AdapterFactory adapterFactory)
This constructs an instance from a factory and a notifier.

Method Detail

getPropertyDescriptorsForHelper

public void getPropertyDescriptorsForHelper(Mapping mapping)

getPropertyDescriptors

public java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
This returns the property descriptors for the adapted class.

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

getChildrenFeatures

public java.util.Collection<? extends EStructuralFeature> getChildrenFeatures(java.lang.Object object)
This specifies how to implement getChildren(java.lang.Object) and is used to deduce an appropriate feature for an AddCommand, RemoveCommand or MoveCommand in createCommand(java.lang.Object, org.eclipse.emf.edit.domain.EditingDomain, java.lang.Class, org.eclipse.emf.edit.command.CommandParameter).

Overrides:
getChildrenFeatures in class ItemProviderAdapter

getChildFeature

protected EStructuralFeature getChildFeature(java.lang.Object object,
                                             java.lang.Object child)
Description copied from class: ItemProviderAdapter
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.

Overrides:
getChildFeature in class ItemProviderAdapter

getSetFeature

public EStructuralFeature getSetFeature(java.lang.Object object,
                                        java.lang.Object value)
Description copied from class: ItemProviderAdapter
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.

Overrides:
getSetFeature in class ItemProviderAdapter

getMappedObjectItemProvider

protected MappedObjectItemProvider getMappedObjectItemProvider(Mapping mapping,
                                                               java.lang.Object mappedObject)

substituteMappedObjectItemProvider

protected java.lang.Object substituteMappedObjectItemProvider(Mapping mapping,
                                                              java.lang.Object object)

substituteMappedObject

protected java.lang.Object substituteMappedObject(Mapping mapping,
                                                  java.lang.Object object)

createValueIterator

public static java.util.Iterator<?> createValueIterator(java.lang.Object object)

getChildren

public java.util.Collection<?> getChildren(java.lang.Object object)
Description copied from class: ItemProviderAdapter
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.

Specified by:
getChildren in interface IEditingDomainItemProvider
Specified by:
getChildren in interface ITreeItemContentProvider
Overrides:
getChildren in class ItemProviderAdapter

hasChildren

public boolean hasChildren(java.lang.Object object)
Description copied from class: ItemProviderAdapter
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 ItemProviderAdapter.hasChildren(Object, boolean) (i.e. by passing true as the second argument).

Specified by:
hasChildren in interface ITreeItemContentProvider
Overrides:
hasChildren in class ItemProviderAdapter
See Also:
ItemProviderAdapter.hasChildren(Object, boolean)

getParent

public java.lang.Object getParent(java.lang.Object object)
This returns the nestedIn of the Mapping.

Specified by:
getParent in interface IEditingDomainItemProvider
Specified by:
getParent in interface ITreeItemContentProvider
Overrides:
getParent in class ItemProviderAdapter

getImage

public static java.lang.Object getImage(MappingRoot mappingRoot,
                                        java.lang.String prefix,
                                        java.util.Collection<?> collection)

getImage

public static java.lang.Object getImage(MappingRoot mappingRoot,
                                        java.lang.String prefix,
                                        java.util.Collection<?> collection,
                                        boolean supportNone)

getImage

public static java.lang.Object getImage(java.lang.String prefix,
                                        java.util.Collection<?> tops,
                                        java.util.Collection<?> bottoms)

getImage

public static java.lang.Object getImage(java.lang.String prefix,
                                        java.util.Collection<?> tops,
                                        java.util.Collection<?> bottoms,
                                        boolean supportNone)

getImage

public static java.lang.Object getImage(java.lang.String prefix,
                                        int topsSize,
                                        int bottomsSize,
                                        boolean supportNone)

getImage

public java.lang.Object getImage(java.lang.Object object)
This returns Mapping.gif.

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

getText

public static java.lang.String getText(MappingRoot mappingRoot,
                                       AdapterFactory adapterFactory,
                                       java.util.Collection<?> collection)

getText

public static java.lang.String getText(MappingRoot mappingRoot,
                                       AdapterFactory adapterFactory,
                                       java.util.Collection<?> collection,
                                       java.lang.String pathSeparator)

getText

public static java.lang.String getText(MappingRoot mappingRoot,
                                       AdapterFactory adapterFactory,
                                       java.util.Collection<?> collection,
                                       java.lang.String pathSeparator,
                                       java.lang.String objectSeparator,
                                       java.lang.String divider)

getText

public static java.lang.String getText(MappingRoot mappingRoot,
                                       AdapterFactory adapterFactory,
                                       java.util.Collection<?> inputs,
                                       java.util.Collection<?> outputs)

getText

public static java.lang.String getText(MappingRoot mappingRoot,
                                       AdapterFactory adapterFactory,
                                       java.util.Collection<?> inputs,
                                       java.util.Collection<?> outputs,
                                       java.lang.String objectSeparator,
                                       java.lang.String divider)

getText

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

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

notifyChanged

public void notifyChanged(Notification msg)
This handles notification by delegating to fireNotifyChanged.

Specified by:
notifyChanged in interface Adapter
Overrides:
notifyChanged in class AdapterImpl
Parameters:
msg - a description of the change.

createCommand

public Command createCommand(java.lang.Object object,
                             EditingDomain editingDomain,
                             java.lang.Class<? extends Command> commandClass,
                             CommandParameter commandParameter)
Description copied from class: ItemProviderAdapter
This implements delegated command creation for the given object.

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

createNameMatchMappingCommand

protected Command createNameMatchMappingCommand(MappingDomain domain,
                                                Mapping mapping)
This creates a primitive NameMatchMappingCommand.


createTypeMatchMappingCommand

protected Command createTypeMatchMappingCommand(MappingDomain domain,
                                                Mapping mapping)
This creates a primitive TypeMatchMappingCommand.


createRemoveCommand

protected Command createRemoveCommand(EditingDomain domain,
                                      EObject owner,
                                      EStructuralFeature feature,
                                      java.util.Collection<?> collection)
Description copied from class: ItemProviderAdapter
This creates a primitive RemoveCommand.

Overrides:
createRemoveCommand in class ItemProviderAdapter

factorAddCommand

protected Command factorAddCommand(EditingDomain domain,
                                   CommandParameter commandParameter)
Description copied from class: ItemProviderAdapter
This method factors an AddCommand for a collection of objects into one or more primitive add command, i.e., one per unique feature.

Overrides:
factorAddCommand in class ItemProviderAdapter

createAddCommand

protected Command createAddCommand(EditingDomain domain,
                                   EObject owner,
                                   EStructuralFeature feature,
                                   java.util.Collection<?> collection,
                                   int index)
Description copied from class: ItemProviderAdapter
This creates a primitive AddCommand.

Overrides:
createAddCommand in class ItemProviderAdapter

createMoveCommand

protected Command createMoveCommand(EditingDomain domain,
                                    EObject owner,
                                    EStructuralFeature feature,
                                    EObject value,
                                    int index)
This creates a primitive MoveCommand.


createSetCommand

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

Overrides:
createSetCommand in class ItemProviderAdapter

dispose

public void dispose()
Description copied from class: ItemProviderAdapter
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
Overrides:
dispose in class ItemProviderAdapter

getResourceLocator

public ResourceLocator getResourceLocator()
Return the resource locator for this item provider's resources.

Overrides:
getResourceLocator in class ItemProviderAdapter

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