Search in sources :

Example 16 with XSDModelGroupDefinition

use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.

the class XSDModelGroupDefinitionAdapter method getText.

public String getText() {
    XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
    // Removed
    if (xsdModelGroupDefinition.getResolvedModelGroupDefinition().getContainer() == null && xsdModelGroupDefinition.getName() == null)
        return "";
    String result = xsdModelGroupDefinition.isModelGroupDefinitionReference() ? xsdModelGroupDefinition.getQName() : xsdModelGroupDefinition.getName();
    return result == null ? Messages._UI_LABEL_ABSENT : result;
}
Also used : XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition)

Example 17 with XSDModelGroupDefinition

use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.

the class XSDModelGroupDefinitionAdapter method getChildren.

public ITreeElement[] getChildren() {
    XSDModelGroupDefinition def = (XSDModelGroupDefinition) target;
    List list = new ArrayList();
    // entries in the tree viewer for the same item
    if (!def.isModelGroupDefinitionReference()) {
        XSDModelGroup xsdModelGroup = ((XSDModelGroupDefinition) target).getResolvedModelGroupDefinition().getModelGroup();
        if (xsdModelGroup != null)
            list.add(xsdModelGroup);
    }
    List adapterList = new ArrayList();
    populateAdapterList(list, adapterList);
    return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
}
Also used : XSDModelGroup(org.eclipse.xsd.XSDModelGroup) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) ITreeElement(org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement)

Example 18 with XSDModelGroupDefinition

use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.

the class XSDModelGroupDefinitionAdapter method getTopContainer.

public IADTObject getTopContainer() {
    XSDModelGroupDefinition group = getXSDModelGroupDefinition();
    XSDConcreteComponent container = group.getContainer();
    if (container instanceof XSDSchema || container instanceof XSDRedefine)
        return this;
    else
        return getGlobalXSDContainer(group);
}
Also used : XSDRedefine(org.eclipse.xsd.XSDRedefine) XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 19 with XSDModelGroupDefinition

use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.

the class XSDRedefineAdapter method getCategoryChildren.

private List getCategoryChildren(int category) {
    List list = new ArrayList();
    XSDRedefine redefine = (XSDRedefine) target;
    Iterator iterator = redefine.getContents().iterator();
    while (iterator.hasNext()) {
        XSDRedefineContent redefineContent = (XSDRedefineContent) iterator.next();
        if (redefineContent instanceof XSDAttributeGroupDefinition && category == CategoryAdapter.ATTRIBUTES) {
            list.add(redefineContent);
        } else if (redefineContent instanceof XSDModelGroupDefinition && category == CategoryAdapter.GROUPS) {
            list.add(redefineContent);
        } else if (redefineContent instanceof XSDComplexTypeDefinition && category == CategoryAdapter.TYPES) {
            list.add(redefineContent);
        } else if (redefineContent instanceof XSDSimpleTypeDefinition && category == CategoryAdapter.TYPES) {
            list.add(redefineContent);
        }
    }
    List adapterList = new ArrayList();
    populateAdapterList(list, adapterList);
    return adapterList;
}
Also used : XSDRedefine(org.eclipse.xsd.XSDRedefine) XSDRedefineContent(org.eclipse.xsd.XSDRedefineContent) XSDSimpleTypeDefinition(org.eclipse.xsd.XSDSimpleTypeDefinition) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition) XSDAttributeGroupDefinition(org.eclipse.xsd.XSDAttributeGroupDefinition)

Example 20 with XSDModelGroupDefinition

use of org.eclipse.xsd.XSDModelGroupDefinition in project tmdm-studio-se by Talend.

the class TreeExpandHelper method getName.

private String getName(Object objA) {
    if (objA instanceof XSDElementDeclaration) {
        XSDElementDeclaration decl = (XSDElementDeclaration) objA;
        return decl.getName();
    }
    if (objA instanceof XSDModelGroup) {
        XSDModelGroup goup = (XSDModelGroup) objA;
        XSDParticle particle = (XSDParticle) goup.getContainer();
        XSDComplexTypeDefinition complexTypeDefinition = (XSDComplexTypeDefinition) particle.getContainer();
        String name = complexTypeDefinition.getName();
        return name;
    }
    if (objA instanceof XSDModelGroupDefinition) {
        XSDModelGroupDefinition goupDef = (XSDModelGroupDefinition) objA;
        return goupDef.getName();
    }
    if (objA instanceof XSDParticle) {
        XSDParticle particle = (XSDParticle) objA;
        if (particle.getTerm() instanceof XSDElementDeclaration) {
            XSDElementDeclaration decl = (XSDElementDeclaration) particle.getTerm();
            return decl.getName();
        }
    }
    if (objA instanceof XSDAnnotation) {
        return null;
    }
    if (objA instanceof XSDIdentityConstraintDefinition) {
        XSDIdentityConstraintDefinition constraint = (XSDIdentityConstraintDefinition) objA;
        return constraint.getName();
    }
    if (objA instanceof XSDSimpleTypeDefinition) {
        XSDSimpleTypeDefinition simpleDefine = (XSDSimpleTypeDefinition) objA;
        return simpleDefine.getName();
    }
    if (objA instanceof XSDComplexTypeDefinition) {
        XSDComplexTypeDefinition complexDefine = (XSDComplexTypeDefinition) objA;
        return complexDefine.getName();
    }
    return null;
}
Also used : XSDModelGroup(org.eclipse.xsd.XSDModelGroup) XSDElementDeclaration(org.eclipse.xsd.XSDElementDeclaration) XSDSimpleTypeDefinition(org.eclipse.xsd.XSDSimpleTypeDefinition) XSDIdentityConstraintDefinition(org.eclipse.xsd.XSDIdentityConstraintDefinition) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition) XSDAnnotation(org.eclipse.xsd.XSDAnnotation) XSDParticle(org.eclipse.xsd.XSDParticle)

Aggregations

XSDModelGroupDefinition (org.eclipse.xsd.XSDModelGroupDefinition)43 XSDModelGroup (org.eclipse.xsd.XSDModelGroup)19 XSDElementDeclaration (org.eclipse.xsd.XSDElementDeclaration)18 List (java.util.List)15 ArrayList (java.util.ArrayList)13 Iterator (java.util.Iterator)12 XSDAttributeGroupDefinition (org.eclipse.xsd.XSDAttributeGroupDefinition)11 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)11 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)11 XSDParticle (org.eclipse.xsd.XSDParticle)10 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)10 XSDAttributeDeclaration (org.eclipse.xsd.XSDAttributeDeclaration)9 XSDSchema (org.eclipse.xsd.XSDSchema)9 XSDIdentityConstraintDefinition (org.eclipse.xsd.XSDIdentityConstraintDefinition)8 XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)7 XSDRedefine (org.eclipse.xsd.XSDRedefine)6 XSDWildcard (org.eclipse.xsd.XSDWildcard)6 Adapter (org.eclipse.emf.common.notify.Adapter)5 EObject (org.eclipse.emf.ecore.EObject)4 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)4