Search in sources :

Example 31 with XSDModelGroupDefinition

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

the class TypesHelper method getModelGroups.

public java.util.List getModelGroups() {
    Vector items = new Vector();
    if (xsdSchema != null) {
        updateExternalImportGlobals();
        if (xsdSchema.getModelGroupDefinitions() != null) {
            Iterator i = xsdSchema.getModelGroupDefinitions().iterator();
            while (i.hasNext()) {
                XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) i.next();
                String name = modelGroupDefinition.getQName(xsdSchema);
                if (name != null) {
                    items.add(name);
                }
            }
        }
        // items = addExternalImportedGroups(items);
        items = (Vector) sortList(items);
    }
    return items;
}
Also used : Iterator(java.util.Iterator) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) Vector(java.util.Vector)

Example 32 with XSDModelGroupDefinition

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

the class ModelGroupDefinitionReferenceEditPart method getModelChildren.

protected List getModelChildren() {
    List list = new ArrayList();
    XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) getModel();
    XSDModelGroupDefinition groupDef = ((XSDModelGroupDefinition) adapter.getTarget());
    XSDModelGroupDefinition resolvedGroupDef = groupDef.getResolvedModelGroupDefinition();
    XSDModelGroup xsdModelGroup = resolvedGroupDef.getModelGroup();
    ArrayList listOfVisibleGroupRefs = new ArrayList();
    for (EditPart ep = getParent(); ep != null; ) {
        Object object = ep.getModel();
        if (object instanceof XSDModelGroupDefinitionAdapter) {
            Object model = ((XSDModelGroupDefinitionAdapter) object).getTarget();
            if (model instanceof XSDModelGroupDefinition) {
                listOfVisibleGroupRefs.add(((XSDModelGroupDefinition) model).getResolvedModelGroupDefinition());
            }
        }
        ep = ep.getParent();
    }
    boolean isCyclic = (listOfVisibleGroupRefs.contains(resolvedGroupDef));
    if (xsdModelGroup != null && !isCyclic)
        list.add(XSDAdapterFactory.getInstance().adapt(xsdModelGroup));
    if (isCyclic)
        list.add(new TargetConnectionSpaceFiller(null));
    return list;
}
Also used : XSDModelGroupDefinitionAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter) XSDModelGroup(org.eclipse.xsd.XSDModelGroup) ArrayList(java.util.ArrayList) BaseEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart) EditPart(org.eclipse.gef.EditPart) List(java.util.List) ArrayList(java.util.ArrayList) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) TargetConnectionSpaceFiller(org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller)

Example 33 with XSDModelGroupDefinition

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

the class AddXSDRedefinedModelGroupAction method buildComponentsList.

protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList) {
    List modelGroupList = xsdRedefine.getIncorporatedSchema().getModelGroupDefinitions();
    Iterator iterator = modelGroupList.iterator();
    while (iterator.hasNext()) {
        XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) iterator.next();
        String modelGroupDefinitionName = modelGroupDefinition.getName();
        if (!redefinedComponentsNames.contains(modelGroupDefinitionName)) {
            componentList.add(modelGroupDefinition);
        }
    }
}
Also used : Iterator(java.util.Iterator) List(java.util.List) IComponentList(org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition)

Example 34 with XSDModelGroupDefinition

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

the class XSDModelGroupSection method refresh.

public void refresh() {
    super.refresh();
    if (isReadOnly) {
        composite.setEnabled(false);
    } else {
        composite.setEnabled(true);
    }
    setListenerEnabled(false);
    if (input != null) {
        if (input instanceof XSDModelGroup) {
            XSDModelGroup particle = (XSDModelGroup) input;
            String modelType = particle.getCompositor().getName();
            modelGroupCombo.setText(modelType);
            minCombo.setEnabled(!(particle.eContainer() instanceof XSDModelGroupDefinition));
            maxCombo.setEnabled(!(particle.eContainer() instanceof XSDModelGroupDefinition));
        }
    }
    refreshMinMax();
    setListenerEnabled(true);
}
Also used : XSDModelGroup(org.eclipse.xsd.XSDModelGroup) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition)

Example 35 with XSDModelGroupDefinition

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

the class AddXSDElementCommand method getModelGroup.

// PORT
public XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType) {
    XSDParticle particle = null;
    XSDComplexTypeContent xsdComplexTypeContent = cType.getContent();
    if (xsdComplexTypeContent instanceof XSDParticle) {
        particle = (XSDParticle) xsdComplexTypeContent;
    }
    if (particle == null) {
        return null;
    }
    Object particleContent = particle.getContent();
    XSDModelGroup group = null;
    if (particleContent instanceof XSDModelGroupDefinition) {
        group = ((XSDModelGroupDefinition) particleContent).getResolvedModelGroupDefinition().getModelGroup();
    } else if (particleContent instanceof XSDModelGroup) {
        group = (XSDModelGroup) particleContent;
    }
    if (group == null) {
        return null;
    }
    return group;
}
Also used : XSDComplexTypeContent(org.eclipse.xsd.XSDComplexTypeContent) XSDModelGroup(org.eclipse.xsd.XSDModelGroup) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition) 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