Search in sources :

Example 36 with XSDTerm

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

the class XSDAddComplexTypeElementAction method updateCompositorType.

private boolean updateCompositorType(XSDTypeDefinition superType, XSDModelGroup currentGroup) {
    XSDParticle superTypeParticle = superType.getComplexType();
    XSDTerm term = superTypeParticle.getTerm();
    if (term instanceof XSDModelGroup) {
        XSDModelGroup group = (XSDModelGroup) term;
        if (group.getCompositor() == XSDCompositor.ALL_LITERAL || currentGroup.getCompositor() == XSDCompositor.ALL_LITERAL) {
            if (MessageDialog.openConfirm(null, Messages._ChangeToSequenceType, Messages._ComplexTypeToSequence)) {
                group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
                superTypeParticle.updateElement();
                currentGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
                currentGroup.updateElement();
                return true;
            }
            return false;
        }
    }
    return true;
}
Also used : XSDModelGroup(org.eclipse.xsd.XSDModelGroup) XSDTerm(org.eclipse.xsd.XSDTerm) XSDParticle(org.eclipse.xsd.XSDParticle)

Aggregations

XSDTerm (org.eclipse.xsd.XSDTerm)36 XSDElementDeclaration (org.eclipse.xsd.XSDElementDeclaration)32 XSDParticle (org.eclipse.xsd.XSDParticle)31 XSDModelGroup (org.eclipse.xsd.XSDModelGroup)28 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)21 XSDAnnotation (org.eclipse.xsd.XSDAnnotation)16 XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)13 XSDIdentityConstraintDefinition (org.eclipse.xsd.XSDIdentityConstraintDefinition)10 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)10 TreeObject (com.amalto.workbench.models.TreeObject)9 ArrayList (java.util.ArrayList)9 EList (org.eclipse.emf.common.util.EList)9 XSDComplexTypeContent (org.eclipse.xsd.XSDComplexTypeContent)8 XSDWildcard (org.eclipse.xsd.XSDWildcard)8 XSDXPathDefinition (org.eclipse.xsd.XSDXPathDefinition)8 Iterator (java.util.Iterator)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 XSDAttributeGroupDefinition (org.eclipse.xsd.XSDAttributeGroupDefinition)6 Element (org.w3c.dom.Element)6 XSDAnnotationsStructure (com.amalto.workbench.utils.XSDAnnotationsStructure)5