/** * Returns a list of all top level elements that are of a type derived from the type of the * specified element. * * @param element The element. * @return All elements which are of a type derived from the type of the specified element. */ public static final List getDerivedElementDeclarations(XSDElementDeclaration element) { List elements = element.getSchema().getElementDeclarations(); List derived = new ArrayList(); for (Iterator itr = elements.iterator(); itr.hasNext(); ) { XSDElementDeclaration derivee = (XSDElementDeclaration) itr.next(); if (derivee.equals(element)) { continue; // same element } XSDTypeDefinition type = derivee.getType(); while (true) { if (type.equals(element.getType())) { derived.add(derivee); break; } if (type.equals(type.getBaseType())) { break; } type = type.getBaseType(); } } return derived; }
List elements = element.getSchema().getElementDeclarations(); List derived = new ArrayList();
@Override public Object getPropertyDefaultValue(Object o) { return XSDEditPlugin.INSTANCE.getString ("_UI_DefaultValue_label", new Object [] { ((XSDElementDeclaration)o).getSchema().getElementFormDefault().getName() }); } });
List elements = element.getSchema().getElementDeclarations(); List derived = new ArrayList();
public IModel getModel() { Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDElementDeclaration().getSchema()); return (IModel)adapter; }
List elements = element.getSchema().getElementDeclarations(); List derived = new ArrayList();
public Image getImage(Object element) { if ( element instanceof XSDElementDeclaration){ // Workaround trick: (trung) we create a temporary Dom element and put it in the label provider // to get the image. String namespace = ((XSDElementDeclaration) element).getSchema().getTargetNamespace(); String name = ((XSDElementDeclaration) element).getName(); Element tempElement = tempDoc.createElementNS(namespace, name); ILabelProvider lp = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry().getLabelProvider(namespace); if (lp != null){ Image img = lp.getImage(tempElement); if (img != null){ return img; } } return DEFAULT_ELEMENT_ICON; } else if ( element instanceof XSDAttributeDeclaration){ return DEFAULT_ATTRIBUTE_ICON; } return null; }
if (component.getMetaName() == IXSDSearchConstants.ELEMENT_META_NAME) AddXSDElementCommand command = new AddXSDElementCommand(Messages._UI_ACTION_ADD_ELEMENT, concreteComponent.getSchema()); command.setNameToAdd(component.getName()); command.execute(); Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, elementDec.getQName(concreteComponent.getSchema())); command.execute(); Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, ((XSDElementDeclaration)component.getObject()).getQName(concreteComponent.getSchema())); command.execute();
if (component.getMetaName() == IXSDSearchConstants.ELEMENT_META_NAME) AddXSDElementCommand command = new AddXSDElementCommand(Messages._UI_ACTION_ADD_ELEMENT, concreteComponent.getSchema()); command.setNameToAdd(component.getName()); command.execute();
elementDeclaration.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string") ); //$NON-NLS-1$ elementDeclaration.setAnonymousTypeDefinition(simpleType);