protected void setUseToRequired(EAttribute attribute, XSDAttributeUse attrUse) { if (attribute.isRequired()) { attrUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } }
protected void setUseToRequired(EAttribute attribute, XSDAttributeUse attrUse) { if (attribute.isRequired()) { attrUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } }
public void undo() { if (component instanceof XSDParticle) { if (removeMinOccursAttribute) { ((XSDParticle) component).unsetMinOccurs(); } else { ((XSDParticle) component).setMinOccurs(oldMinOccurs); } } else if (component instanceof XSDAttributeUse) { if (removeMinOccursAttribute) { ((XSDParticle) component).unsetMinOccurs(); } else { if (oldMinOccurs == 1) ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); else ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } } } }
public void execute() { Element element = component.getElement(); try { beginRecording(element); String currentMin = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE); removeMinOccursAttribute = (currentMin == null) ? true : false; if (component instanceof XSDParticle) { oldMinOccurs = ((XSDParticle) component).getMinOccurs(); ((XSDParticle) component).setMinOccurs(newMinOccurs); } else if (component instanceof XSDAttributeUse) { oldMinOccurs = (((XSDAttributeUse) component).getUse() == XSDAttributeUseCategory.REQUIRED_LITERAL ? 1 : 0); if (newMinOccurs == 1) ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); else ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } } finally { endRecording(); } }
protected XSDAttributeUse createAttributeUse(XSDSchema schema, String name, String type, String use, String form, String fixed) { XSDAttributeDeclaration attributeDeclaration = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attributeDeclaration.setName(name); attributeDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); if ("qualified".equals(form)) { attributeDeclaration.setForm(XSDForm.QUALIFIED_LITERAL); } XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attributeUse.setContent(attributeDeclaration); if ("optional".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } if ("required".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } if (fixed != null) { attributeUse.setConstraint(XSDConstraint.FIXED_LITERAL); attributeUse.setLexicalValue("2.0"); } return attributeUse; }
protected XSDAttributeUse createAttributeUse(XSDSchema schema, String name, String type, String use, String form, String fixed) { XSDAttributeDeclaration attributeDeclaration = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attributeDeclaration.setName(name); attributeDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); if ("qualified".equals(form)) { attributeDeclaration.setForm(XSDForm.QUALIFIED_LITERAL); } XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attributeUse.setContent(attributeDeclaration); if ("optional".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL); } if ("required".equals(use)) { attributeUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); } if (fixed != null) { attributeUse.setConstraint(XSDConstraint.FIXED_LITERAL); attributeUse.setLexicalValue("2.0"); } return attributeUse; }
/*{@link */XSDAttributeUse/*}*/ simpleAttributeUse = xsdFactory.createXSDAttributeUse(); simpleAttributeUse./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationReference); simpleAttributeUse./*{@link XSDAttributeUse#setUse */setUse/*}*/(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL); simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);
/*{@link */XSDAttributeUse/*}*/ simpleAttributeUse = xsdFactory.createXSDAttributeUse(); simpleAttributeUse./*{@link XSDAttributeUse#setContent */setContent/*}*/(simpleAttributeDeclarationReference); simpleAttributeUse./*{@link XSDAttributeUse#setUse */setUse/*}*/(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL); simpleRecursiveComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);
simpleAttributeUse.setUse(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL); simpleContentComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);
simpleAttributeUse.setUse(/*{@link */XSDAttributeUseCategory/*}*/.OPTIONAL_LITERAL); simpleContentComplexTypeDefinition./*{@link XSDComplexTypeDefinition#getAttributeContents */getAttributeContents/*}*/().add(simpleAttributeUse);
xsdAttriuteUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); canHaveDefault = false;
xsdAttriuteUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); canHaveDefault = false;
XSDAttributeUse partNumAttributeUse = xsdFactory.createXSDAttributeUse(); partNumAttributeUse.setContent(partNum); partNumAttributeUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); itemsType.getAttributeContents().add(partNumAttributeUse);
XSDAttributeUse partNumAttributeUse = xsdFactory.createXSDAttributeUse(); partNumAttributeUse.setContent(partNum); partNumAttributeUse.setUse(XSDAttributeUseCategory.REQUIRED_LITERAL); itemsType.getAttributeContents().add(partNumAttributeUse);