use of org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionAdapter method getChildren.
public ITreeElement[] getChildren() {
XSDAttributeGroupDefinition xsdAttributeGroup = (XSDAttributeGroupDefinition) target;
List list = new ArrayList();
Iterator iterator = xsdAttributeGroup.getContents().iterator();
while (iterator.hasNext()) {
Object o = iterator.next();
if (o instanceof XSDAttributeUse) {
list.add(((XSDAttributeUse) o).getAttributeDeclaration());
} else {
list.add(o);
}
}
XSDWildcard wildcard = xsdAttributeGroup.getAttributeWildcardContent();
if (wildcard != null) {
list.add(wildcard);
}
List adapterList = new ArrayList();
populateAdapterList(list, adapterList);
return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
}
use of org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement in project webtools.sourceediting by eclipse.
the class XSDElementDeclarationAdapter method getChildren.
public ITreeElement[] getChildren() {
XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) target;
List list = new ArrayList();
XSDTypeDefinition type = null;
if (xsdElementDeclaration.isElementDeclarationReference()) {
type = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
} else {
type = xsdElementDeclaration.getAnonymousTypeDefinition();
if (type == null) {
type = xsdElementDeclaration.getTypeDefinition();
}
}
if (type instanceof XSDComplexTypeDefinition && type.getTargetNamespace() != null && !type.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) {
XSDComplexTypeDefinition ctType = (XSDComplexTypeDefinition) type;
if (ctType != null) {
if (xsdElementDeclaration.isGlobal())
list.add(ctType);
}
}
List adapterList = new ArrayList();
populateAdapterList(list, adapterList);
return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
}
use of org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement 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.wst.xsd.ui.internal.adt.outline.ITreeElement in project webtools.sourceediting by eclipse.
the class XSDModelGroupAdapter method getChildren.
public ITreeElement[] getChildren() {
XSDModelGroup xsdModelGroup = getXSDModelGroup();
List list = new ArrayList();
for (Iterator i = xsdModelGroup.getContents().iterator(); i.hasNext(); ) {
Object object = i.next();
XSDParticleContent particle = ((XSDParticle) object).getContent();
if (particle instanceof XSDElementDeclaration) {
list.add(particle);
} else if (particle instanceof XSDWildcard) {
list.add(particle);
} else if (particle instanceof XSDModelGroup) {
list.add(particle);
} else if (particle instanceof XSDModelGroupDefinition) {
// list.add(((XSDModelGroupDefinition)particle).getResolvedModelGroupDefinition());
list.add(particle);
}
}
List adapterList = new ArrayList();
populateAdapterList(list, adapterList);
return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
}
use of org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement in project webtools.sourceediting by eclipse.
the class XSDSchemaAdapter method getChildren.
/*
* (non-Javadoc)
*
* @see org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement#getChildren()
*/
public ITreeElement[] getChildren() {
XSDSchema xsdSchema = (XSDSchema) getTarget();
children = new ArrayList();
// already created
if (fDirectivesCategory != null) {
List directivesList = getDirectives(xsdSchema);
List elementsList = getGlobalElements(xsdSchema);
List attributesList = getAttributeList(xsdSchema);
List groups = getGroups(xsdSchema);
List types = getComplexTypes(xsdSchema);
types.addAll(getSimpleTypes(xsdSchema));
fDirectivesCategory.setChildren(directivesList);
fDirectivesCategory.setAllChildren(directivesList);
fElementsCategory.setChildren(elementsList);
fElementsCategory.setAllChildren(getGlobalElements(xsdSchema, true));
fAttributesCategory.setChildren(attributesList);
fAttributesCategory.setAllChildren(getAttributeList(xsdSchema, true));
fTypesCategory.setChildren(types);
fTypesCategory.setAllChildren(getTypes(xsdSchema, true));
fGroupsCategory.setChildren(groups);
fGroupsCategory.setAllChildren(getGroups(xsdSchema, true));
} else {
createCategoryAdapters(xsdSchema);
}
children.add(fDirectivesCategory);
children.add(fElementsCategory);
children.add(fAttributesCategory);
children.add(fTypesCategory);
children.add(fGroupsCategory);
return (ITreeElement[]) children.toArray(new ITreeElement[0]);
}
Aggregations