|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.common.notify.impl.AdapterImpl
org.eclipse.emf.edit.provider.ItemProviderAdapter
org.eclipse.xsd.provider.XSDItemProviderAdapter
public class XSDItemProviderAdapter
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
.
Nested Class Summary | |
---|---|
static class |
XSDItemProviderAdapter.ItemPropertyDescriptorWithDefault
|
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 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(AdapterFactory adapterFactory)
This creates an instance from an adapter factory. |
Method Summary | |
---|---|
protected void |
addModelGroupChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors,
EReference feature,
boolean all,
boolean useParticle)
This is a convenience method for creating CommandParameter s
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,
EReference feature,
boolean atomic,
boolean list,
boolean union)
This is a convenience method for creating CommandParameter s
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 CommandParameter |
createChildParameter(EReference feature,
XSDConcreteComponent child)
This is a convenience method for creating CommandParameter s
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,
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<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,
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.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 |
---|
protected static final XSDPackage xsdPackage
protected static final XSDFactory xsdFactory
protected AdapterFactoryItemDelegator itemDelegator
Constructor Detail |
---|
protected XSDItemProviderAdapter(AdapterFactory adapterFactory)
Method Detail |
---|
public java.lang.Object getParent(java.lang.Object object)
getParent
in class ItemProviderAdapter
public java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)
getPropertyDescriptors
in class ItemProviderAdapter
protected java.lang.Object getParticleOrAttributeUseContent(java.lang.Object object)
object
is a particle or an attribute use, this returns
its content; otherwise, object
itself.
protected CommandParameter createChildParameter(EReference feature, XSDConcreteComponent child)
CommandParameter
s
for a given parent feature and child object.
protected void addModelGroupChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors, EReference feature, boolean all, boolean useParticle)
CommandParameter
s
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.
protected void addSimpleTypeDefinitionChildParameters(java.util.Collection<java.lang.Object> newChildDescriptors, XSDConcreteComponent parent, EReference feature, boolean atomic, boolean list, boolean union)
CommandParameter
s
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
.
protected boolean isGlobal(java.lang.Object parent)
protected XSDAttributeDeclaration createAttributeDeclaration(XSDConcreteComponent parent)
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.
protected java.util.Collection<? extends XSDAttributeUse> getAttributeSiblings(XSDConcreteComponent parent)
null
if there is no such parent.
protected boolean isUniqueAttributeDeclarationName(java.lang.String localName, java.lang.String targetNamespace, java.util.Collection<? extends XSDAttributeUse> attributeUses)
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.
protected XSDElementDeclaration createElementDeclaration(XSDConcreteComponent parent)
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.
protected XSDModelGroup getTopModelGroup(XSDConcreteComponent parent)
null
.
protected boolean isUniqueElementDeclarationName(java.lang.String localName, java.lang.String targetNamespace, XSDModelGroup modelGroup, java.util.HashSet<XSDModelGroup> visited)
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.
protected XSDAttributeGroupDefinition createAttributeGroupDefinition(XSDConcreteComponent parent)
XSDAttributeGroupDefinition
with a name that is unique globally, and that resolves to
itself. The created object is to be added under the specified
parent
.
protected XSDModelGroupDefinition createModelGroupDefinition(XSDConcreteComponent parent)
XSDModelGroupDefinition
with a name that is unique globally, and that resolves to
itself. The created object is to be added under the specified
parent
.
protected XSDComplexTypeDefinition createComplexTypeDefinition(XSDConcreteComponent parent)
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
.
protected XSDSimpleTypeDefinition createSimpleTypeDefinition(XSDConcreteComponent parent)
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
.
protected XSDIdentityConstraintDefinition createIdentityConstraintDefinition(XSDConcreteComponent parent)
XSDIdentityConstraintDefinition
with a name that is unique
globally. The created object is to be added under the specified
parent
.
protected XSDNotationDeclaration createNotationDeclaration(XSDConcreteComponent parent)
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.
protected XSDAttributeUse createAttributeUse(XSDAttributeDeclaration attributeDeclaration, boolean isReference)
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 XSDAttributeGroupDefinition createAttributeGroupDefinitionReference(XSDAttributeGroupDefinition attributeGroupDefinition)
XSDAttributeGroupDefinition
that resolves to attributeGroupDefinition
.
protected XSDParticle createParticle(XSDParticleContent particleContent, boolean isReference)
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 java.lang.String getNewObjectName(java.lang.String typeName)
public java.util.Collection<?> getCreateChildResult(java.lang.Object child)
CreateChildCommand
.
getCreateChildResult
in interface CreateChildCommand.Helper
getCreateChildResult
in class ItemProviderAdapter
public java.lang.String getCreateChildText(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
CreateChildCommand
.
getCreateChildText
in interface CreateChildCommand.Helper
getCreateChildText
in class ItemProviderAdapter
public java.lang.String getCreateChildDescription(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
CreateChildCommand
.
getCreateChildDescription
in interface CreateChildCommand.Helper
getCreateChildDescription
in class ItemProviderAdapter
public java.lang.String getCreateChildToolTipText(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
CreateChildCommand
.
getCreateChildToolTipText
in interface CreateChildCommand.Helper
getCreateChildToolTipText
in class ItemProviderAdapter
protected java.lang.String getTypeText(java.lang.Object object, java.lang.String qualifier)
object
's type,
qualified by qualifier
, if it is non-null.
public java.lang.Object getCreateChildImage(java.lang.Object parent, java.lang.Object feature, java.lang.Object child, java.util.Collection<?> selection)
CreateChildCommand
.
getCreateChildImage
in interface CreateChildCommand.Helper
getCreateChildImage
in class ItemProviderAdapter
protected java.lang.String getTypeTextQualifier(java.lang.Object parent, EReference feature, java.lang.Object child)
protected java.lang.String getImageNameQualifier(java.lang.Object parent, EReference feature, java.lang.Object child)
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |