if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) { return (AttributeType) findType(xsdType);
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; }
public boolean isFocusAllowed() { XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target; if (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace())) { return false; } if (xsdSimpleTypeDefinition.getName() == null) { return false; } return true; }
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 (isSameNamespace(st.getTargetNamespace(),schema.getTargetNamespace()) && (st.getRootContainer() == schema || showFromIncludes)) { list.add(st); } } } List adapterList = new ArrayList(); populateAdapterList(list, adapterList); return adapterList; }
/** * Returns whether the type definition is a built-in type with the given name * or is derived from a built-in type with that name. * @param xsdSimpleTypeDefinition a type definition. * @return whether the type definition is a built-in type with the given name * or is derived from a built-in type with that name. * @since 2.4 */ public static boolean isOrIsDerivedFrom(XSDSimpleTypeDefinition xsdSimpleTypeDefinition, String name) { Set<XSDTypeDefinition> visited = new HashSet<XSDTypeDefinition>(); while (xsdSimpleTypeDefinition != null) { if (isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()) && name.equals(xsdSimpleTypeDefinition.getName())) { return true; } if (!visited.add(xsdSimpleTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition())) { return false; } } return false; }
public static boolean isLocalReferenceType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { while (xsdSimpleTypeDefinition != null) { if (XSDConstants.isAnySimpleType(xsdSimpleTypeDefinition)) { return false; } String name = xsdSimpleTypeDefinition.getName(); if (XSDConstants.isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()) && ("IDREF".equals(name) || "IDREFS".equals(name))) { return true; } xsdSimpleTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); } return false; }
public static boolean isLocalReferenceType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { while (xsdSimpleTypeDefinition != null) { if (XSDConstants.isAnySimpleType(xsdSimpleTypeDefinition)) { return false; } String name = xsdSimpleTypeDefinition.getName(); if (XSDConstants.isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()) && ("IDREF".equals(name) || "IDREFS".equals(name))) { return true; } xsdSimpleTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); } return false; }
public String getTypeNameQualifier() { XSDAttributeDeclaration attr = getResolvedXSDAttributeDeclaration(); if (attr != null) { if (attr.getTypeDefinition() != null) { return attr.getTypeDefinition().getTargetNamespace(); } } return null; }
/** * Returns whether the simple type definition is the * <a href="http://www.w3.org/TR/xmlschema-2/#dt-ID">ID</a>. * @param xsdSimpleTypeDefinition a simple type definition. * @return whether the simple type definition is */ public static boolean isOrIsDerivedFromID(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { while (xsdSimpleTypeDefinition != null) { if (isURType(xsdSimpleTypeDefinition)) { return false; } if (isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()) && "ID".equals(xsdSimpleTypeDefinition.getName())) { return true; } xsdSimpleTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); } return false; } }
protected void checkForPrimitive(XSDSimpleTypeDefinition xsdSimpleTypeDefinition, EDataType eDataType) { if (EcorePackage.eNS_URI.equals(xsdSimpleTypeDefinition.getTargetNamespace())) { String wrapperType = ECORE_PRIMITIVE_TYPES.get(eDataType.getName()); if (wrapperType != null) { XSDSimpleTypeDefinition wrapperTypeDefinition = xsdSimpleTypeDefinition.resolveSimpleTypeDefinition(wrapperType); if (wrapperTypeDefinition.getContainer() != null) { EDataType eDataTypeObject = (EDataType)getEClassifier(wrapperTypeDefinition); extendedMetaData.setName(eDataTypeObject, eDataType.getName() + ":Object"); extendedMetaData.setBaseType(eDataTypeObject, eDataType); typeToTypeObjectMap.put(eDataType, eDataTypeObject); return; } } } checkForPrimitive(eDataType); }
protected void checkForPrimitive(XSDSimpleTypeDefinition xsdSimpleTypeDefinition, EDataType eDataType) { if (EcorePackage.eNS_URI.equals(xsdSimpleTypeDefinition.getTargetNamespace())) { String wrapperType = ECORE_PRIMITIVE_TYPES.get(eDataType.getName()); if (wrapperType != null) { XSDSimpleTypeDefinition wrapperTypeDefinition = xsdSimpleTypeDefinition.resolveSimpleTypeDefinition(wrapperType); if (wrapperTypeDefinition.getContainer() != null) { EDataType eDataTypeObject = (EDataType)getEClassifier(wrapperTypeDefinition); extendedMetaData.setName(eDataTypeObject, eDataType.getName() + ":Object"); extendedMetaData.setBaseType(eDataTypeObject, eDataType); typeToTypeObjectMap.put(eDataType, eDataTypeObject); return; } } } checkForPrimitive(eDataType); }
if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
if (value.contains("child:") && xsdSimpleTypeDefinition != null && XSDUtil.isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()))
public void setInput(IWorkbenchPart part, ISelection selection) { super.setInput(part, selection); init(); XSDSchema schemaOfType = null; if (!isReadOnly) { schemaOfType = xsdSimpleTypeDefinition.getSchema(); } if (schemaOfType == owningEditor.getAdapter(XSDSchema.class)) { isReadOnly = false; } else { if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace())) isReadOnly = true; } if (hasMaxMinFacets) { title.setText(titleString + (isReadOnly ? " - " + Messages._UI_LABEL_READONLY : "")); //$NON-NLS-1$ //$NON-NLS-2$ } relayout(); constraintsWidget.setCommandStack(getCommandStack()); }
while (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(targetST.getTargetNamespace()) && targetST != null)
@Override protected void patch() { super.patch(); XSDAttributeDeclaration theResolvedAttributeDeclaration = getResolvedAttributeDeclaration(); if (theResolvedAttributeDeclaration == this) { XSDSimpleTypeDefinition typeDefinition = getTypeDefinition(); if (typeDefinition != null && (forceResolve && typeDefinition.getName() != null || typeDefinition.getContainer() == null)) { XSDSimpleTypeDefinition newTypeDefinition = resolveSimpleTypeDefinition(typeDefinition.getTargetNamespace(), typeDefinition.getName()); if (forceResolve || newTypeDefinition.getContainer() != null & newTypeDefinition != typeDefinition) { setTypeDefinitionGen(newTypeDefinition); } } } else { XSDAttributeDeclaration newResolvedAttributeDeclaration = resolveAttributeDeclaration(theResolvedAttributeDeclaration.getTargetNamespace(), theResolvedAttributeDeclaration.getName()); if (newResolvedAttributeDeclaration != theResolvedAttributeDeclaration) { setResolvedAttributeDeclaration(newResolvedAttributeDeclaration); } } }
@Override protected void patch() { super.patch(); XSDAttributeDeclaration theResolvedAttributeDeclaration = getResolvedAttributeDeclaration(); if (theResolvedAttributeDeclaration == this) { XSDSimpleTypeDefinition typeDefinition = getTypeDefinition(); if (typeDefinition != null && (forceResolve && typeDefinition.getName() != null || typeDefinition.getContainer() == null)) { XSDSimpleTypeDefinition newTypeDefinition = resolveSimpleTypeDefinition(typeDefinition.getTargetNamespace(), typeDefinition.getName()); if (forceResolve || newTypeDefinition.getContainer() != null & newTypeDefinition != typeDefinition) { setTypeDefinitionGen(newTypeDefinition); } } } else { XSDAttributeDeclaration newResolvedAttributeDeclaration = resolveAttributeDeclaration(theResolvedAttributeDeclaration.getTargetNamespace(), theResolvedAttributeDeclaration.getName()); if (newResolvedAttributeDeclaration != theResolvedAttributeDeclaration) { setResolvedAttributeDeclaration(newResolvedAttributeDeclaration); } } }
if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
clonedAttributeDeclaration.setTypeDefinition (createUnresolvedSimpleTypeDefinition (theTypeDefinition.getTargetNamespace(), theTypeDefinition.getName()));
clonedAttributeDeclaration.setTypeDefinition (createUnresolvedSimpleTypeDefinition (theTypeDefinition.getTargetNamespace(), theTypeDefinition.getName()));