org.eclipse.xsd.provider
Class XSDItemProviderAdapter

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.emf.edit.provider.ItemProviderAdapter
          extended by org.eclipse.xsd.provider.XSDItemProviderAdapter
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal, org.eclipse.emf.common.util.ResourceLocator, org.eclipse.emf.edit.command.CreateChildCommand.Helper, org.eclipse.emf.edit.provider.IChangeNotifier, org.eclipse.emf.edit.provider.IDisposable
Direct Known Subclasses:
XSDAttributeGroupContentItemProvider, XSDConcreteComponentItemProvider, XSDDiagnosticItemProvider, XSDScopeItemProvider

public class XSDItemProviderAdapter
extends org.eclipse.emf.edit.provider.ItemProviderAdapter
implements org.eclipse.emf.edit.command.CreateChildCommand.Helper

This is the base for all adapters. It takes handles the getParent() implementation that is need for XSDParticleItemProvider and XSDAttributeUseItemProvider to skip up to a particle or attribute use. It also supports CreateChildCommand by supplying text and icons, and provides methods that assist the derived adapters in overriding ItemProviderAdapter.collectNewChildDescriptors(java.util.Collection, java.lang.Object).


Nested Class Summary
static class XSDItemProviderAdapter.ItemPropertyDescriptorWithDefault
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
org.eclipse.emf.edit.provider.ItemProviderAdapter.ChildrenStore, org.eclipse.emf.edit.provider.ItemProviderAdapter.ModifiableSingletonEList<E>, org.eclipse.emf.edit.provider.ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommand, org.eclipse.emf.edit.provider.ItemProviderAdapter.ResultAndAffectedObjectsWrappingCommandActionDelegate
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
protected  org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator itemDelegator
           
protected static XSDFactory xsdFactory
           
protected static XSDPackage xsdPackage
           
 
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
protected XSDItemProviderAdapter(org.eclipse.emf.common.notify.AdapterFactory adapterFactory)
          This creates an instance from an adapter factory.
 
Method Summary
protected  void addModelGroupChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors, org.eclipse.emf.ecore.EReference feature, boolean all, boolean useParticle)
          This is a convenience method for creating CommandParameters for model groups of two or all of the three compositor types (choice, sequence, and optionally all, depending on the value of all) and adding them to a newChildDescriptors collection.
protected  void addSimpleTypeDefinitionChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors, XSDConcreteComponent parent, org.eclipse.emf.ecore.EReference feature, boolean atomic, boolean list, boolean union)
          This is a convenience method for creating CommandParameters for simple type definitions of zero, one, two, or all of three varieties (atomic, list, and union), and adding them to a newChildDescriptors collection.
protected  XSDAttributeDeclaration createAttributeDeclaration(XSDConcreteComponent parent)
          This creates an object of type XSDAttributeDeclaration with a name that is unique globally (compared to other global attribute declarations) or locally (compared to sibling attribute declarations and children of sibling attribute groups), depending on the type of the specified parent.
protected  XSDAttributeGroupDefinition createAttributeGroupDefinition(XSDConcreteComponent parent)
          This creates an object of type XSDAttributeGroupDefinition with a name that is unique globally, and that resolves to itself.
protected  XSDAttributeGroupDefinition createAttributeGroupDefinitionReference(XSDAttributeGroupDefinition attributeGroupDefinition)
          This creates an object of type XSDAttributeGroupDefinition that resolves to attributeGroupDefinition.
protected  XSDAttributeUse createAttributeUse(XSDAttributeDeclaration attributeDeclaration, boolean isReference)
          This creates an object of type XSDAttributeUse containing an object of type XSDAttributeDeclaration -- if isReference is true, the attribute use content will be a new attribute declaration that resolves to attributeDeclaration; otherwise, it will be simply attributeDeclaration itself.
protected  org.eclipse.emf.edit.command.CommandParameter createChildParameter(org.eclipse.emf.ecore.EReference feature, XSDConcreteComponent child)
          This is a convenience method for creating CommandParameters for a given parent feature and child object.
protected  XSDComplexTypeDefinition createComplexTypeDefinition(XSDConcreteComponent parent)
          This creates an object of type XSDComplexTypeDefinition with a name that is unique globally, if this is to be a global definition; otherwise, with no name.
protected  XSDElementDeclaration createElementDeclaration(XSDConcreteComponent parent)
          This creates an object of type XSDElementDeclaration with a name that is unique globally or locally, depending on the type of the specified parent.
protected  XSDIdentityConstraintDefinition createIdentityConstraintDefinition(XSDConcreteComponent parent)
          This creates an object of type XSDIdentityConstraintDefinition with a name that is unique globally.
protected  XSDModelGroupDefinition createModelGroupDefinition(XSDConcreteComponent parent)
          This creates an object of type XSDModelGroupDefinition with a name that is unique globally, and that resolves to itself.
protected  XSDNotationDeclaration createNotationDeclaration(XSDConcreteComponent parent)
          This creates an object of type XSDNotationDeclaration with a name that is unique globally.
protected  XSDParticle createParticle(XSDParticleContent particleContent, boolean isReference)
          This creates an object of type XSDParticle containing an object of type XSDParticleContent -- if either particleContent is an element declaration and isReference is true or particleContent is a model group definition, the particle content will be a new element declaration that resolves to particleContent; otherwise, it will be simply particleContent itself.
protected  XSDSimpleTypeDefinition createSimpleTypeDefinition(XSDConcreteComponent parent)
          This creates an object of type XSDSimpleTypeDefinition with a name that is unique globally, if this is to be a global definition; otherwise, with no name.
protected  java.util.Collection<? extends XSDAttributeUse> getAttributeSiblings(XSDConcreteComponent parent)
          This gathers and returns the siblings by stepping up through any attribute group definitions to the top-most parent attribute definition or complex type definition, and returning the attribute uses for it.
 java.lang.String getCreateChildDescription(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the translated description for CreateChildCommand.
 java.lang.Object getCreateChildImage(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the icon for CreateChildCommand.
 java.util.Collection<?> getCreateChildResult(java.lang.Object child)
          This returns the default result collection for CreateChildCommand.
 java.lang.String getCreateChildText(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the translated label for CreateChildCommand.
 java.lang.String getCreateChildToolTipText(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
          This returns the translated tool tip for CreateChildCommand.
protected  java.lang.String getImageNameQualifier(java.lang.Object parent, org.eclipse.emf.ecore.EReference feature, java.lang.Object child)
          This generates and returns a qualifier string, for use in forming the icon filename, based on the state of the child object, its parent, and the feature under which is to be added.
protected  java.lang.String getNewObjectName(java.lang.String typeName)
          This returns the translated name for a new object with the specified type name.
 java.lang.Object getParent(java.lang.Object object)
          This returns the parent.
protected  java.lang.Object getParticleOrAttributeUseContent(java.lang.Object object)
          If object is a particle or an attribute use, this returns its content; otherwise, object itself.
 java.util.List<org.eclipse.emf.edit.provider.IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
           
protected  XSDModelGroup getTopModelGroup(XSDConcreteComponent parent)
          If the specified parent is a model group, this finds and returns the top-most model group above it (within the same complex type or model group definition).
protected  java.lang.String getTypeText(java.lang.Object object, java.lang.String qualifier)
          This gets the translated string for object's type, qualified by qualifier, if it is non-null.
protected  java.lang.String getTypeTextQualifier(java.lang.Object parent, org.eclipse.emf.ecore.EReference feature, java.lang.Object child)
          This generates and returns a qualifier string, for use in forming the type key, based on the state of the child object, its parent, and the feature under which it is to be added.
protected  boolean isGlobal(java.lang.Object parent)
          This determines whether an object represents a global element, based on the type of its parent.
protected  boolean isUniqueAttributeDeclarationName(java.lang.String localName, java.lang.String targetNamespace, java.util.Collection<? extends XSDAttributeUse> attributeUses)
          This tests whether the combination of given localName and targetNamespace is shared by an attribute declaration of an attribute use in the given collection.
protected  boolean isUniqueElementDeclarationName(java.lang.String localName, java.lang.String targetNamespace, XSDModelGroup modelGroup, java.util.HashSet<XSDModelGroup> visited)
          This tests whether the combination of given localName and targetNamespace is shared by an element declaration in the given model group or a model group under it.
 
Methods inherited from class org.eclipse.emf.edit.provider.ItemProviderAdapter
addListener, adjustWrapperIndex, adjustWrapperIndices, adjustWrapperIndices, collectNewChildDescriptors, createAddCommand, createAddCommand, createChildParameter, createChildrenStore, createCommand, createCopyCommand, createCreateChildCommand, createCreateChildCommand, createCreateCopyCommand, createDragAndDropCommand, createInitializeCopyCommand, createItemPropertyDescriptor, createItemPropertyDescriptor, createMoveCommand, createMoveCommand, createRemoveCommand, createRemoveCommand, createReplaceCommand, createReplaceCommand, createSetCommand, createSetCommand, createWrapper, crop, dispose, disposeWrapper, disposeWrappers, factorAddCommand, factorMoveCommand, factorRemoveCommand, fireNotifyChanged, getAdapterFactory, getBackground, getBackground, getBaseURL, getChildFeature, getChildReference, getChildren, getChildrenFeatures, getChildrenReferences, getChildrenStore, getColumnImage, getColumnText, getEditableValue, getElements, getFeatureText, getFeatureValue, getFont, getFont, getForeground, getForeground, getImage, getImage, getNewChildDescriptors, getPropertyDescriptor, getPropertyValue, getReferenceValue, getResourceLocator, getResourceLocator, getRootAdapterFactory, getSetFeature, getSetFeatures, getString, getString, getString, getString, getString, getString, getString, getString, getText, getTypeText, getTypeText, getUpdateableText, getWrappedValues, hasChildren, hasChildren, isAdapterForType, isEquivalentValue, isPropertySet, isValidValue, isWrappingNeeded, overlayImage, removeListener, resetPropertyValue, setPropertyValue, setTarget, shouldComposeCreationImage, shouldTranslate, unsetTarget, unwrap, unwrapCommandValues, updateChildren, wrap, wrapCommand
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, notifyChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xsdPackage

protected static final XSDPackage xsdPackage

xsdFactory

protected static final XSDFactory xsdFactory

itemDelegator

protected org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator itemDelegator
Constructor Detail

XSDItemProviderAdapter

protected XSDItemProviderAdapter(org.eclipse.emf.common.notify.AdapterFactory adapterFactory)
This creates an instance from an adapter factory.

Method Detail

getParent

public java.lang.Object getParent(java.lang.Object object)
This returns the parent.

Overrides:
getParent in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getPropertyDescriptors

public java.util.List<org.eclipse.emf.edit.provider.IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
Overrides:
getPropertyDescriptors in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getParticleOrAttributeUseContent

protected java.lang.Object getParticleOrAttributeUseContent(java.lang.Object object)
If object is a particle or an attribute use, this returns its content; otherwise, object itself.


createChildParameter

protected org.eclipse.emf.edit.command.CommandParameter createChildParameter(org.eclipse.emf.ecore.EReference feature,
                                                                             XSDConcreteComponent child)
This is a convenience method for creating CommandParameters for a given parent feature and child object.


addModelGroupChildParameters

protected void addModelGroupChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors,
                                            org.eclipse.emf.ecore.EReference feature,
                                            boolean all,
                                            boolean useParticle)
This is a convenience method for creating CommandParameters for model groups of two or all of the three compositor types (choice, sequence, and optionally all, depending on the value of all) and adding them to a newChildDescriptors collection. If useParticle is true, each model group will be the content of a new particle.


addSimpleTypeDefinitionChildParameters

protected void addSimpleTypeDefinitionChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors,
                                                      XSDConcreteComponent parent,
                                                      org.eclipse.emf.ecore.EReference feature,
                                                      boolean atomic,
                                                      boolean list,
                                                      boolean union)
This is a convenience method for creating CommandParameters for simple type definitions of zero, one, two, or all of three varieties (atomic, list, and union), and adding them to a newChildDescriptors collection. The simple type definition objects are to be added to the specified feature of parent. The varieties for which to create simple type definitions and command parameters are specified by the three boolean arguments, atomic, list, and union.


isGlobal

protected boolean isGlobal(java.lang.Object parent)
This determines whether an object represents a global element, based on the type of its parent.


createAttributeDeclaration

protected XSDAttributeDeclaration createAttributeDeclaration(XSDConcreteComponent parent)
This creates an object of type XSDAttributeDeclaration with a name that is unique globally (compared to other global attribute declarations) or locally (compared to sibling attribute declarations and children of sibling attribute groups), depending on the type of the specified parent. The created object will be initialized to resolve to itself and to have the string type definition.

Note: in determining local uniqueness, we do not consider any referenced uses of the parent group or type elsewhere in the schema.


getAttributeSiblings

protected java.util.Collection<? extends XSDAttributeUse> getAttributeSiblings(XSDConcreteComponent parent)
This gathers and returns the siblings by stepping up through any attribute group definitions to the top-most parent attribute definition or complex type definition, and returning the attribute uses for it. Returns null if there is no such parent.


isUniqueAttributeDeclarationName

protected boolean isUniqueAttributeDeclarationName(java.lang.String localName,
                                                   java.lang.String targetNamespace,
                                                   java.util.Collection<? extends XSDAttributeUse> attributeUses)
This tests whether the combination of given localName and targetNamespace is shared by an attribute declaration of an attribute use in the given collection. Returns false if so, true otherwise. Note that this method is tolerant of nulls: a result of true is returned if attributeUse is null, and two null strings are considered equal.


createElementDeclaration

protected XSDElementDeclaration createElementDeclaration(XSDConcreteComponent parent)
This creates an object of type XSDElementDeclaration with a name that is unique globally or locally, depending on the type of the specified parent. The created object will be initialized to resolve to itself and to have the string type definition.

Note: in determining local uniqueness, we do not consider any referenced uses of the parent group or type elsewhere in the schema.


getTopModelGroup

protected XSDModelGroup getTopModelGroup(XSDConcreteComponent parent)
If the specified parent is a model group, this finds and returns the top-most model group above it (within the same complex type or model group definition). Otherwise, returns null.


isUniqueElementDeclarationName

protected boolean isUniqueElementDeclarationName(java.lang.String localName,
                                                 java.lang.String targetNamespace,
                                                 XSDModelGroup modelGroup,
                                                 java.util.HashSet<XSDModelGroup> visited)
This tests whether the combination of given localName and targetNamespace is shared by an element declaration in the given model group or a model group under it. Returns false if so, true otherwise. Note that this method is tolerant of nulls: a result of true is returned if modelGroup is null, and two null strings are considered equal. Also, note that the visited argument is used to avoid an infinite recursion situation, and should be null when the method is initially called.


createAttributeGroupDefinition

protected XSDAttributeGroupDefinition createAttributeGroupDefinition(XSDConcreteComponent parent)
This creates an object of type XSDAttributeGroupDefinition with a name that is unique globally, and that resolves to itself. The created object is to be added under the specified parent.


createModelGroupDefinition

protected XSDModelGroupDefinition createModelGroupDefinition(XSDConcreteComponent parent)
This creates an object of type XSDModelGroupDefinition with a name that is unique globally, and that resolves to itself. The created object is to be added under the specified parent.


createComplexTypeDefinition

protected XSDComplexTypeDefinition createComplexTypeDefinition(XSDConcreteComponent parent)
This creates an object of type XSDComplexTypeDefinition with a name that is unique globally, if this is to be a global definition; otherwise, with no name. The created object is to be added under the specified parent.


createSimpleTypeDefinition

protected XSDSimpleTypeDefinition createSimpleTypeDefinition(XSDConcreteComponent parent)
This creates an object of type XSDSimpleTypeDefinition with a name that is unique globally, if this is to be a global definition; otherwise, with no name. The created object is to be added under the specified parent.


createIdentityConstraintDefinition

protected XSDIdentityConstraintDefinition createIdentityConstraintDefinition(XSDConcreteComponent parent)
This creates an object of type XSDIdentityConstraintDefinition with a name that is unique globally. The created object is to be added under the specified parent.


createNotationDeclaration

protected XSDNotationDeclaration createNotationDeclaration(XSDConcreteComponent parent)
This creates an object of type XSDNotationDeclaration with a name that is unique globally. The created object, to be added under the specified parent, will have an empty string as its public identifier.


createAttributeUse

protected XSDAttributeUse createAttributeUse(XSDAttributeDeclaration attributeDeclaration,
                                             boolean isReference)
This creates an object of type XSDAttributeUse containing an object of type XSDAttributeDeclaration -- if isReference is true, the attribute use content will be a new attribute declaration that resolves to attributeDeclaration; otherwise, it will be simply attributeDeclaration itself.


createAttributeGroupDefinitionReference

protected XSDAttributeGroupDefinition createAttributeGroupDefinitionReference(XSDAttributeGroupDefinition attributeGroupDefinition)
This creates an object of type XSDAttributeGroupDefinition that resolves to attributeGroupDefinition.


createParticle

protected XSDParticle createParticle(XSDParticleContent particleContent,
                                     boolean isReference)
This creates an object of type XSDParticle containing an object of type XSDParticleContent -- if either particleContent is an element declaration and isReference is true or particleContent is a model group definition, the particle content will be a new element declaration that resolves to particleContent; otherwise, it will be simply particleContent itself.


getNewObjectName

protected java.lang.String getNewObjectName(java.lang.String typeName)
This returns the translated name for a new object with the specified type name.


getCreateChildResult

public java.util.Collection<?> getCreateChildResult(java.lang.Object child)
This returns the default result collection for CreateChildCommand.

Specified by:
getCreateChildResult in interface org.eclipse.emf.edit.command.CreateChildCommand.Helper
Overrides:
getCreateChildResult in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getCreateChildText

public java.lang.String getCreateChildText(java.lang.Object parent,
                                           java.lang.Object feature,
                                           java.lang.Object child,
                                           java.util.Collection<?> selection)
This returns the translated label for CreateChildCommand.

Specified by:
getCreateChildText in interface org.eclipse.emf.edit.command.CreateChildCommand.Helper
Overrides:
getCreateChildText in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getCreateChildDescription

public java.lang.String getCreateChildDescription(java.lang.Object parent,
                                                  java.lang.Object feature,
                                                  java.lang.Object child,
                                                  java.util.Collection<?> selection)
This returns the translated description for CreateChildCommand.

Specified by:
getCreateChildDescription in interface org.eclipse.emf.edit.command.CreateChildCommand.Helper
Overrides:
getCreateChildDescription in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getCreateChildToolTipText

public java.lang.String getCreateChildToolTipText(java.lang.Object parent,
                                                  java.lang.Object feature,
                                                  java.lang.Object child,
                                                  java.util.Collection<?> selection)
This returns the translated tool tip for CreateChildCommand.

Specified by:
getCreateChildToolTipText in interface org.eclipse.emf.edit.command.CreateChildCommand.Helper
Overrides:
getCreateChildToolTipText in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getTypeText

protected java.lang.String getTypeText(java.lang.Object object,
                                       java.lang.String qualifier)
This gets the translated string for object's type, qualified by qualifier, if it is non-null.


getCreateChildImage

public java.lang.Object getCreateChildImage(java.lang.Object parent,
                                            java.lang.Object feature,
                                            java.lang.Object child,
                                            java.util.Collection<?> selection)
This returns the icon for CreateChildCommand.

Specified by:
getCreateChildImage in interface org.eclipse.emf.edit.command.CreateChildCommand.Helper
Overrides:
getCreateChildImage in class org.eclipse.emf.edit.provider.ItemProviderAdapter

getTypeTextQualifier

protected java.lang.String getTypeTextQualifier(java.lang.Object parent,
                                                org.eclipse.emf.ecore.EReference feature,
                                                java.lang.Object child)
This generates and returns a qualifier string, for use in forming the type key, based on the state of the child object, its parent, and the feature under which it is to be added.


getImageNameQualifier

protected java.lang.String getImageNameQualifier(java.lang.Object parent,
                                                 org.eclipse.emf.ecore.EReference feature,
                                                 java.lang.Object child)
This generates and returns a qualifier string, for use in forming the icon filename, based on the state of the child object, its parent, and the feature under which is to be added.


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