public SchemaIndexImpl(XSDSchema[] schemas) { this.schemas = new XSDSchema[schemas.length + 1]; adapter = new SchemaAdapter(); // set the schemas passed in for (int i = 0; i < schemas.length; i++) { this.schemas[i] = schemas[i]; synchronized (this.schemas[i].eAdapters()) { this.schemas[i].eAdapters().add(adapter); } } // add the schema for xml schema itself this.schemas[schemas.length] = schemas[0].getSchemaForSchema(); }
public SchemaIndexImpl(XSDSchema[] schemas) { this.schemas = new XSDSchema[schemas.length + 1]; //set the schemas passed in for (int i = 0; i < schemas.length; i++) { this.schemas[i] = schemas[i]; this.schemas[i].eAdapters().add(new SchemaAdapter()); } //add the schema for xml schema itself this.schemas[schemas.length] = schemas[0].getSchemaForSchema(); }
public SchemaIndexImpl(XSDSchema[] schemas) { this.schemas = new XSDSchema[ schemas.length + 1 ]; //set the schemas passed in for ( int i = 0; i < schemas.length; i++ ) { this.schemas[ i ] = schemas[ i ]; this.schemas[i].eAdapters().add( new SchemaAdapter()); } //add the schema for xml schema itself this.schemas[schemas.length] = schemas[0].getSchemaForSchema(); }
public SchemaIndexImpl(XSDSchema[] schemas) { this.schemas = new XSDSchema[schemas.length + 1]; //set the schemas passed in for (int i = 0; i < schemas.length; i++) { this.schemas[i] = schemas[i]; this.schemas[i].eAdapters().add(new SchemaAdapter()); } //add the schema for xml schema itself this.schemas[schemas.length] = schemas[0].getSchemaForSchema(); }
protected XSDDiagnostic checkComplexContent (XSDComplexTypeDefinition xsdComplexTypeDefinition, String part, String anchor, Element element) { List<XSDDiagnostic> xsdDiagnostics = XSDUtil.checkComplexContent(xsdComplexTypeDefinition, part, anchor, element); for (XSDDiagnostic xsdDiagnostic : xsdDiagnostics) { xsdDiagnostic.setPrimaryComponent(this); } getDiagnostics().addAll(xsdDiagnostics); return xsdDiagnostics.isEmpty() ? null : xsdDiagnostics.get(xsdDiagnostics.size() - 1); }
protected XSDDiagnostic checkBuiltInTypeConstraint (String builtInTypeName, String value, String part, String anchor, Element element, String attributeName, boolean isRequired) { XSDSimpleTypeDefinition builtInType = getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(builtInTypeName); return checkSimpleTypeConstraint(builtInType, value, part, anchor, element, attributeName, isRequired); }
protected void setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration) { addEMFSchema(); xsdAttributeDeclaration.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition(REFERENCE_TYPE_NAME)); }
protected XSDDiagnostic checkBuiltInTypeConstraint (String builtInTypeName, String value, String part, String anchor, Element element, String attributeName, boolean isRequired) { XSDSimpleTypeDefinition builtInType = getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(builtInTypeName); return checkSimpleTypeConstraint(builtInType, value, part, anchor, element, attributeName, isRequired); }
protected void setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration) { addEMFSchema(); xsdAttributeDeclaration.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition(REFERENCE_TYPE_NAME)); }
protected XSDDiagnostic checkElementComplexContent (String elementName, String part, String anchor, Element element) { XSDElementDeclaration xsdElementDeclaration = getSchema().getSchemaForSchema().resolveElementDeclaration(elementName); return checkComplexContent((XSDComplexTypeDefinition)xsdElementDeclaration.getTypeDefinition(), part, anchor, element); }
protected XSDDiagnostic checkElementComplexContent (String elementName, String part, String anchor, Element element) { XSDElementDeclaration xsdElementDeclaration = getSchema().getSchemaForSchema().resolveElementDeclaration(elementName); return checkComplexContent((XSDComplexTypeDefinition)xsdElementDeclaration.getTypeDefinition(), part, anchor, element); }
protected XSDAttributeDeclaration createGlobalXSDAttributeDeclaration(XSDSchema xsdSchema) { ensureSchemaElement(xsdSchema); XSDAttributeDeclaration attribute = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attribute.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$ attribute.setName(XSDCommonUIUtils.createUniqueElementName("NewAttribute", xsdSchema.getAttributeDeclarations())); //$NON-NLS-1$ Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$ xsdSchema.getElement().appendChild(textNode); xsdSchema.getContents().add(attribute); return attribute; }
public void visitElementDeclaration(org.eclipse.xsd.XSDElementDeclaration element) { if (element.getTypeDefinition() == target) { XSDSimpleTypeDefinition type = target.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ element.setTypeDefinition(type); } super.visitElementDeclaration(element); } };
protected XSDParticle createXSDElementDeclarationForComplexType() { XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration(); ArrayList usedAttributeNames = new ArrayList(); usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdComplexTypeDefinition)); usedAttributeNames.addAll(XSDCommonUIUtils.getInheritedAttributes(xsdComplexTypeDefinition)); element.setName(XSDCommonUIUtils.createUniqueElementName( nameToAdd == null ? "NewElement" : nameToAdd , usedAttributeNames)); //$NON-NLS-1$ element.setTypeDefinition(type); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(element); addedXSDConcreteComponent = element; return particle; }
protected XSDParticle createXSDElementDeclarationForModelGroupDefinitions() { XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration(); ArrayList usedAttributeNames = new ArrayList(); usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdModelGroupDefinition)); element.setName(XSDCommonUIUtils.createUniqueElementName( nameToAdd == null ? "NewElement" : nameToAdd , usedAttributeNames)); //$NON-NLS-1$ element.setTypeDefinition(type); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(element); addedXSDConcreteComponent = element; return particle; }
public static class FeatureIteratorImpl extends EContentsEList.FeatureIteratorImpl<XSDConcreteComponent> { public FeatureIteratorImpl(EObject eObject) { super(eObject, (EStructuralFeature [])((BasicEList<?>)eObject.eClass().getEAllReferences()).data()); } public FeatureIteratorImpl(EObject eObject, EStructuralFeature [] eStructuralFeatures) { super(eObject, eStructuralFeatures); } @Override protected boolean isIncluded(EStructuralFeature eStructuralFeature) { EReference eReference = (EReference)eStructuralFeature; return !eReference.isTransient(); } } }
protected XSDElementDeclaration createElementDeclaration(XSDSchema schema, String name, String type, boolean schemaType) { XSDElementDeclaration elementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); elementDeclaration.setName(name); if (schemaType) { elementDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); } else { elementDeclaration.setTypeDefinition(schema.resolveSimpleTypeDefinition(type)); } return elementDeclaration; }
protected XSDElementDeclaration createElementDeclaration(XSDSchema schema, String name, String type, boolean schemaType) { XSDElementDeclaration elementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); elementDeclaration.setName(name); if (schemaType) { elementDeclaration.setTypeDefinition(schema.getSchemaForSchema().resolveSimpleTypeDefinition(type)); } else { elementDeclaration.setTypeDefinition(schema.resolveSimpleTypeDefinition(type)); } return elementDeclaration; }
protected XSDElementDeclaration createGlobalXSDElementDeclaration() { ensureSchemaElement(xsdSchema); XSDSimpleTypeDefinition type = xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory(); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(XSDCommonUIUtils.createUniqueElementName( nameToAdd == null ? "NewElement" : nameToAdd , xsdSchema.getElementDeclarations())); //$NON-NLS-1$ element.setTypeDefinition(type); return element; }
/** * Each EEnum is mapped to a schema simple type that restricts the string simple type; * the schema type has an enumeration facet for each EEnumLiteral. */ protected void processEnum(EEnum eEnum) { XSDSimpleTypeDefinition enumType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); enumType.setName(getName(eEnum)); enumType.setBaseTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("NCName")); xsdSchema.getContents().add(enumType); map(enumType, eEnum); for (EEnumLiteral literal : eEnum.getELiterals()) { XSDEnumerationFacet facet = XSDFactory.eINSTANCE.createXSDEnumerationFacet(); facet.setLexicalValue(getName(literal)); enumType.getFacetContents().add(facet); map(facet, literal); } }