Search in sources :

Example 41 with XSDTypeDefinition

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

the class XSDSchemaAdapter method getTypes.

public List getTypes() {
    if (types == null) {
        types = new ArrayList();
        XSDSchema schema = (XSDSchema) target;
        List concreteComponentList = new ArrayList();
        for (Iterator i = schema.getContents().iterator(); i.hasNext(); ) {
            XSDConcreteComponent component = (XSDConcreteComponent) i.next();
            if (component instanceof XSDTypeDefinition) {
                concreteComponentList.add(component);
            }
        }
        populateAdapterList(concreteComponentList, types);
    }
    return types;
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) XSDSchema(org.eclipse.xsd.XSDSchema) XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Example 42 with XSDTypeDefinition

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

the class XSDSchemaAdapter method getComplexTypes.

/**
 * @param schema
 * @return
 */
public List getComplexTypes(XSDSchema schema, boolean showFromIncludes) {
    List allTypes = schema.getTypeDefinitions();
    List list = new ArrayList();
    for (Iterator i = allTypes.iterator(); i.hasNext(); ) {
        XSDTypeDefinition td = (XSDTypeDefinition) i.next();
        if (td instanceof XSDComplexTypeDefinition) {
            XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition) td;
            if (shouldShowComponent(ct, schema, showFromIncludes)) {
                list.add(ct);
            }
        }
    }
    List adapterList = new ArrayList();
    populateAdapterList(list, adapterList);
    return adapterList;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition) XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Example 43 with XSDTypeDefinition

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

the class XSDSchemaAdapter method getSimpleTypes.

public List getSimpleTypes(XSDSchema schema, boolean showFromIncludes) {
    List allTypes = schema.getTypeDefinitions();
    List list = new ArrayList();
    for (Iterator i = allTypes.iterator(); i.hasNext(); ) {
        XSDTypeDefinition td = (XSDTypeDefinition) i.next();
        if (td instanceof XSDSimpleTypeDefinition) {
            XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) td;
            if (shouldShowComponent(st, schema, showFromIncludes)) {
                list.add(st);
            }
        }
    }
    List adapterList = new ArrayList();
    populateAdapterList(list, adapterList);
    return adapterList;
}
Also used : XSDSimpleTypeDefinition(org.eclipse.xsd.XSDSimpleTypeDefinition) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Example 44 with XSDTypeDefinition

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

the class UpdateComplexTypeDerivationBy method execute.

public void execute() {
    super.execute();
    try {
        beginRecording(complexType.getElement());
        XSDTypeDefinition originalBaseType = complexType.getBaseType();
        if (derivation.equals(XSDConstants.EXTENSION_ELEMENT_TAG)) {
            complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        } else if (derivation.equals(XSDConstants.RESTRICTION_ELEMENT_TAG)) {
            complexType.setDerivationMethod(XSDDerivationMethod.RESTRICTION_LITERAL);
        }
        complexType.setBaseTypeDefinition(originalBaseType);
    } finally {
        endRecording();
    }
}
Also used : XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Example 45 with XSDTypeDefinition

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

the class UpdateTypeReferenceAndManageDirectivesCommand method execute.

public void execute() {
    try {
        beginRecording(concreteComponent.getElement());
        XSDComponent td = computeComponent();
        if (td != null && td instanceof XSDTypeDefinition) {
            UpdateTypeReferenceCommand command = new UpdateTypeReferenceCommand(concreteComponent, (XSDTypeDefinition) td);
            command.execute();
            XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
        }
    } catch (Exception e) {
    } finally {
        endRecording();
    }
}
Also used : XSDComponent(org.eclipse.xsd.XSDComponent) XSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)

Aggregations

XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)119 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)66 XSDElementDeclaration (org.eclipse.xsd.XSDElementDeclaration)57 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)46 ArrayList (java.util.ArrayList)39 XSDParticle (org.eclipse.xsd.XSDParticle)36 XSDModelGroup (org.eclipse.xsd.XSDModelGroup)32 Iterator (java.util.Iterator)26 XSDSchema (org.eclipse.xsd.XSDSchema)26 List (java.util.List)22 XSDAttributeDeclaration (org.eclipse.xsd.XSDAttributeDeclaration)17 EList (org.eclipse.emf.common.util.EList)16 TreeObject (com.amalto.workbench.models.TreeObject)14 XSDIdentityConstraintDefinition (org.eclipse.xsd.XSDIdentityConstraintDefinition)14 XSDAttributeGroupDefinition (org.eclipse.xsd.XSDAttributeGroupDefinition)13 XSDTerm (org.eclipse.xsd.XSDTerm)13 XSDFactory (org.eclipse.xsd.XSDFactory)12 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)11 XSDAnnotation (org.eclipse.xsd.XSDAnnotation)10 XSDComplexTypeContent (org.eclipse.xsd.XSDComplexTypeContent)10