@Override public AttributeType buildSuper() { XSDTypeDefinition baseType = xsdType.getBaseType(); if (baseType != null && baseType.getName() != null && !baseType.equals(xsdType)) { return createType(baseType, Integer.MAX_VALUE); } else { return null; } } };
protected AttributeType createType( XSDSimpleTypeDefinition xsdType, int depth ) { if (types.containsKey(xsdType)) { return (AttributeType) types.get(xsdType); } //import? if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) { return (AttributeType) findType(xsdType); } //first build super type AttributeType superType = null; XSDTypeDefinition baseType = xsdType.getBaseType(); if ((baseType != null) && !baseType.equals(xsdType)) { if (baseType.getName() != null) { //ignore unamed types //superType = createType((XSDSimpleTypeDefinition)baseType); superType = createType(baseType, depth+1); assert superType != null; } } //TODO: actually derive valus from type AttributeType gtType = factory.createAttributeType( name(xsdType), Object.class, false, false, Collections.EMPTY_LIST, superType, null ); types.put(xsdType, gtType); return gtType; }
private void fillTypesCombo() { typesCombo.removeAll(); IEditorPart editor = getActiveEditor(); ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class); ComponentSpecification[] items = manager.getQuickPicks(); typesCombo.add(org.eclipse.wst.xsd.ui.internal.adt.editor.Messages._UI_ACTION_BROWSE); typesCombo.add(org.eclipse.wst.xsd.ui.internal.editor.Messages._UI_ACTION_NEW); for (int i = 0; i < items.length; i++) { typesCombo.add(items[i].getName()); } // Add the current Type of this attribute if needed XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input; XSDTypeDefinition baseType = simpleType.getBaseType(); if (baseType != null && baseType.getQName() != null) { String currentTypeName = baseType.getQName(xsdSchema); //no prefix ComponentSpecification ret = getComponentSpecFromQuickPickForValue(currentTypeName,manager); if (ret == null && currentTypeName != null) //not in quickPick { typesCombo.add(currentTypeName); } } }
handleMultiplicity(xsdSchema, eStructuralFeature, xsdSimpleTypeDefinition, baseType); xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSimpleTypeDefinition.getBaseType()); xsdComplexTypeDefinition.setDerivationMethod(xsdSimpleTypeDefinition.getContents().isEmpty() ? XSDDerivationMethod.EXTENSION_LITERAL : XSDDerivationMethod.RESTRICTION_LITERAL); xsdComplexTypeDefinition.setContent(xsdSimpleTypeDefinition);
handleMultiplicity(xsdSchema, eStructuralFeature, xsdSimpleTypeDefinition, baseType); xsdComplexTypeDefinition.setBaseTypeDefinition(xsdSimpleTypeDefinition.getBaseType()); xsdComplexTypeDefinition.setDerivationMethod(xsdSimpleTypeDefinition.getContents().isEmpty() ? XSDDerivationMethod.EXTENSION_LITERAL : XSDDerivationMethod.RESTRICTION_LITERAL); xsdComplexTypeDefinition.setContent(xsdSimpleTypeDefinition);