/** * Get the ISchemaAttribute corresponding to this IDocumentAttributeNode * * @param attr * @param extensionPoint the extension point of the schema, if <code>null</code> it will be * deduced * @return the ISchemaAttribute for <code>attr</code> */ public static ISchemaAttribute getSchemaAttribute( IDocumentAttributeNode attr, String extensionPoint) { ISchemaElement ele = getSchemaElement(attr.getEnclosingElement(), extensionPoint); if (ele == null) return null; return ele.getAttribute(attr.getAttributeName()); }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.model.plugin.DocumentHandler#getDocumentAttribute(java.lang.String, java.lang.String, org.eclipse.pde.internal.ui.model.IDocumentNode) */ protected IDocumentAttributeNode getDocumentAttribute( String name, String value, IDocumentElementNode parent) { IDocumentAttributeNode attr = parent.getDocumentAttribute(name); try { if (attr == null) { attr = fFactory.createAttribute(name, value, parent); } else { if (!name.equals(attr.getAttributeName())) attr.setAttributeName(name); if (!value.equals(attr.getAttributeValue())) attr.setAttributeValue(value); } } catch (CoreException e) { } return attr; }