if ( attribute.getAnonymousTypeDefinition() != null ) { attribute.getAnonymousTypeDefinition().setName( "_" + attribute.getName() ); anonymous.add( attribute.getAnonymousTypeDefinition() );
public static XSDSimpleTypeDefinition getAnonymousSimpleType(XSDFeature input, XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { XSDSimpleTypeDefinition anonymousSimpleType = null; XSDTypeDefinition localType = null; if (input instanceof XSDElementDeclaration) { localType = ((XSDElementDeclaration) input).getAnonymousTypeDefinition(); } else if (input instanceof XSDAttributeDeclaration) { localType = ((XSDAttributeDeclaration) input).getAnonymousTypeDefinition(); } if (localType instanceof XSDSimpleTypeDefinition) { anonymousSimpleType = (XSDSimpleTypeDefinition) localType; } return anonymousSimpleType; }
public String getTextForAttribute(XSDAttributeDeclaration ad, boolean showType) { ad = ad.getResolvedAttributeDeclaration(); String name = ad.getName(); StringBuffer result = new StringBuffer(); if (name == null) { result.append(" " + Messages._UI_LABEL_ABSENT + " "); //$NON-NLS-1$ //$NON-NLS-2$ } else { result.append(name); } if (ad.getAnonymousTypeDefinition() == null && ad.getTypeDefinition() != null) { result.append(" : "); //$NON-NLS-1$ // result.append(resolvedAttributeDeclaration.getTypeDefinition().getQName(xsdAttributeDeclaration)); result.append(ad.getTypeDefinition().getName()); } return result.toString(); }
@Override public String getText(Object object) { XSDAttributeDeclaration xsdAttributeDeclaration = ((XSDAttributeDeclaration)object); XSDAttributeDeclaration resolvedAttributeDeclaration = xsdAttributeDeclaration.getResolvedAttributeDeclaration(); String name = xsdAttributeDeclaration != resolvedAttributeDeclaration ? xsdAttributeDeclaration.getQName() : xsdAttributeDeclaration.getName(); StringBuffer result = new StringBuffer(); if (name == null) { result.append(XSDEditPlugin.INSTANCE.getString("_UI_Absent_label")); } else { result.append(name); } if (resolvedAttributeDeclaration.getAnonymousTypeDefinition() == null && resolvedAttributeDeclaration.getTypeDefinition() != null) { result.append(" : "); result.append(resolvedAttributeDeclaration.getTypeDefinition().getQName(xsdAttributeDeclaration)); } return result.toString(); }
protected boolean canEnable(XSDConcreteComponent selectedObject) { selectedComponent = null; if (selectedObject instanceof XSDNamedComponent) { selectedComponent = (XSDNamedComponent) selectedObject; // if it's element reference, then this action is not appropriate if (selectedComponent instanceof XSDElementDeclaration) { XSDElementDeclaration element = (XSDElementDeclaration) selectedComponent; if (element.isElementDeclarationReference()) { selectedComponent = null; } } if(selectedComponent instanceof XSDTypeDefinition){ XSDTypeDefinition type = (XSDTypeDefinition) selectedComponent; XSDConcreteComponent parent = type.getContainer(); if (parent instanceof XSDElementDeclaration) { XSDElementDeclaration element = (XSDElementDeclaration) parent; if(element.getAnonymousTypeDefinition().equals(type)){ selectedComponent = null; } } else if(parent instanceof XSDAttributeDeclaration) { XSDAttributeDeclaration element = (XSDAttributeDeclaration) parent; if(element.getAnonymousTypeDefinition().equals(type)){ selectedComponent = null; } } } } return canRun(); }
public Object caseXSDAttributeDeclaration(XSDAttributeDeclaration attributeDeclaration) { XSDConcreteComponent target = null; if (attributeDeclaration.isAttributeDeclarationReference()) { target = attributeDeclaration.getResolvedAttributeDeclaration(); } else if (attributeDeclaration.getAnonymousTypeDefinition() == null) { target = attributeDeclaration.getTypeDefinition(); // Avoid navigating to built in data types. if (isFromSchemaForSchema(target)) { target = null; } } return target; }
else if (attrDecl.getAnonymousTypeDefinition() == null)
isAttributeReference = ((XSDAttributeDeclaration)input).isAttributeDeclarationReference(); XSDTypeDefinition typeDef = xsdAttribute.getTypeDefinition(); boolean isAnonymous = xsdAttribute.getAnonymousTypeDefinition() != null;
anonymousTypeDefinition = xsdAttributeDeclaration.getResolvedAttributeDeclaration().getAnonymousTypeDefinition();