use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDComplexTypeDefinitionAdapter method getChildren.
public ITreeElement[] getChildren() {
XSDComplexTypeDefinition xsdComplexTypeDefinition = getXSDComplexTypeDefinition();
List list = new ArrayList();
// Add attributes
for (Iterator i = xsdComplexTypeDefinition.getAttributeContents().iterator(); i.hasNext(); ) {
Object obj = i.next();
if (obj instanceof XSDAttributeUse) {
list.add(((XSDAttributeUse) obj).getAttributeDeclaration());
} else if (obj instanceof XSDAttributeGroupDefinition) {
getAttributeUses((XSDAttributeGroupDefinition) obj, list);
}
}
// Add enumerations
boolean canHaveEnumerations = xsdComplexTypeDefinition.getContentType() instanceof XSDSimpleTypeDefinition && XSDDerivationMethod.RESTRICTION_LITERAL.equals(xsdComplexTypeDefinition.getDerivationMethod());
if (canHaveEnumerations) {
Object contentType = getContentType();
if (contentType != null) {
for (Iterator iterator = ((XSDSimpleTypeDefinition) contentType).getEnumerationFacets().iterator(); iterator.hasNext(); ) {
XSDEnumerationFacet enumerationFacet = (XSDEnumerationFacet) iterator.next();
list.add(enumerationFacet);
}
}
}
XSDWildcard anyAttr = xsdComplexTypeDefinition.getAttributeWildcard();
if (anyAttr != null)
list.add(anyAttr);
// get immediate XSD Model Group of this complex type
if (xsdComplexTypeDefinition.getContent() != null) {
XSDComplexTypeContent xsdComplexTypeContent = xsdComplexTypeDefinition.getContent();
if (xsdComplexTypeContent instanceof XSDParticle) {
XSDParticleContent particleContent = ((XSDParticle) xsdComplexTypeContent).getContent();
if (particleContent instanceof XSDModelGroup) {
list.add(particleContent);
}
}
}
// get inherited XSD Model Group of this complex type
boolean showInheritedContent = XSDEditorPlugin.getPlugin().getShowInheritedContent();
if (showInheritedContent) {
XSDTypeDefinition typeDef = xsdComplexTypeDefinition.getBaseTypeDefinition();
if (typeDef instanceof XSDComplexTypeDefinition) {
XSDComplexTypeDefinition baseCT = (XSDComplexTypeDefinition) typeDef;
if (baseCT.getTargetNamespace() != null && !baseCT.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) {
if (baseCT.getContent() != null) {
XSDComplexTypeContent xsdComplexTypeContent = baseCT.getContent();
if (xsdComplexTypeContent instanceof XSDParticle) {
XSDParticleContent particleContent = ((XSDParticle) xsdComplexTypeContent).getContent();
if (particleContent instanceof XSDModelGroup) {
list.add(particleContent);
}
}
}
}
}
}
List adapterList = new ArrayList();
populateAdapterList(list, adapterList);
return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDSchemaAdapter method getAttributeGroupList.
public List getAttributeGroupList(XSDSchema xsdSchema, boolean showFromIncludes) {
List attributeGroupList = new ArrayList();
for (Iterator i = xsdSchema.getAttributeGroupDefinitions().iterator(); i.hasNext(); ) {
XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) i.next();
if (shouldShowComponent(attrGroup, xsdSchema, showFromIncludes)) {
attributeGroupList.add(attrGroup);
}
}
List adapterList = new ArrayList();
populateAdapterList(attributeGroupList, adapterList);
return adapterList;
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDVisitorForFields method visitAttributeGroupDefinition.
public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup) {
for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext(); ) {
Object o = it.next();
if (o instanceof XSDAttributeUse) {
XSDAttributeUse attributeUse = (XSDAttributeUse) o;
concreteComponentList.add(attributeUse.getAttributeDeclaration());
thingsWeNeedToListenTo.add(attributeUse.getAttributeDeclaration());
} else if (o instanceof XSDAttributeGroupDefinition) {
XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) o;
thingsWeNeedToListenTo.add(attrGroup);
if (attrGroup.isAttributeGroupDefinitionReference()) {
attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
visitAttributeGroupDefinition(attrGroup);
}
}
}
XSDWildcard anyAttribute = attributeGroup.getAttributeWildcardContent();
if (anyAttribute != null) {
concreteComponentList.add(anyAttribute);
thingsWeNeedToListenTo.add(anyAttribute);
}
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDVisitor method visitSchema.
public void visitSchema(XSDSchema schema) {
this.schema = schema;
for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext(); ) {
XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next();
visitAttributeDeclaration(attr);
}
for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext(); ) {
XSDTypeDefinition type = (XSDTypeDefinition) iterator.next();
visitTypeDefinition(type);
}
for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext(); ) {
XSDElementDeclaration element = (XSDElementDeclaration) iterator.next();
visitElementDeclaration(element);
}
for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext(); ) {
XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next();
visitIdentityConstraintDefinition(identityConstraint);
}
for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next();
visitModelGroupDefinition(modelGroup);
}
for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next();
visitAttributeGroupDefinition(attributeGroup);
}
for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext(); ) {
XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next();
visitNotationDeclaration(element);
}
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class TypesHelper method getGlobalAttributeGroups.
public java.util.List getGlobalAttributeGroups() {
Vector items = new Vector();
if (xsdSchema != null) {
updateExternalImportGlobals();
if (xsdSchema.getAttributeGroupDefinitions() != null) {
Iterator i = xsdSchema.getAttributeGroupDefinitions().iterator();
while (i.hasNext()) {
XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) i.next();
String name = attributeGroupDefinition.getQName(xsdSchema);
if (name != null) {
items.add(name);
}
}
}
// items = addExternalImportedAttributeGroups(items);
items = (Vector) sortList(items);
}
return items;
}
Aggregations