@Override public String[] getPropIds(Object element) { IConfigurationElement ice = (IConfigurationElement) element; return ice.getAttributeNames(); }
public ConfigurationKeysEnumeration(IConfigurationElement configuration) { super(); this.keySet = configuration.getAttributeNames(); }
@Override public String[] getAttributeKeys() { return configurationElement.getAttributeNames(); }
private void fillAttributes(IConfigurationElement element) { if (fAttributes == null) { fAttributes = new HashMap(); } else { fAttributes.clear(); } String[] names = element.getAttributeNames(); if (names == null) { return; } int length = names.length; for (int i = 0; i < length; i++) { String name = names[i]; fAttributes.put(name.toLowerCase(), element.getAttribute(name)); } }
@Override public int getAttributeCount() { // if attributes are initialized, don't load the entire map to find the # of elements if (fAttributes == null && fElement != null) return fElement.getAttributeNames().length; return getAttributeMap().size(); }
protected Hashtable<String, IPluginAttribute> getAttributeMap() { if (fAttributes == null) { fAttributes = new Hashtable<>(); if (fElement != null) { String[] names = fElement.getAttributeNames(); for (int i = 0; i < names.length; i++) { IPluginAttribute attr = createAttribute(names[i], fElement.getAttribute(names[i])); if (attr != null) fAttributes.put(names[i], attr); } } } return fAttributes; }
private Attribute[] createConfigurationElementAttributes(IConfigurationElement config) { String[] atts = config.getAttributeNames(); Attribute[] catts = new Attribute[atts.length]; for (int i = 0; i < atts.length; i++) catts[i] = new Attribute(atts[i], config.getAttribute(atts[i])); IConfigurationElement[] children = config.getChildren(); Attribute[] result = new Attribute[children.length + catts.length]; for (int i = 0; i < children.length; i++) { IConfigurationElement child = children[i]; result[i] = createConfigurationElement(child); } for (int i = 0; i < catts.length; i++) { result[children.length + i] = catts[i]; } return result; }
/** * process configuration elements * @param ex the Extension * @param elms the ConfigurationElements to process * @param parent the parent of this ConfigurationElement. null if none */ private void configurationElement(Extension ex, IConfigurationElement[] elms, ConfigurationElement parent) { for( int c=0; c<elms.length; c++) { IConfigurationElement iconfElm = elms[c]; ConfigurationElement confElm = new ConfigurationElement(ex,iconfElm.getName(),null); for( int a=0; a<iconfElm.getAttributeNames().length; a++) { confElm.putAttribute(iconfElm.getAttributeNames()[a], iconfElm.getAttribute(iconfElm.getAttributeNames()[a])); } confElm.setText(iconfElm.getValue()); if( parent == null ) { ex.addConfigurationElement(confElm); } else { parent.addConfigurationElement(confElm); } configurationElement(ex,iconfElm.getChildren(),confElm); } }
for (int j = 0; j < childElement.getAttributeNames().length; j++) String attrName = childElement.getAttributeNames()[j]; if (!attrName.equals(OASISCatalogConstants.ATTR_URI) && !attrName.equals(OASISCatalogConstants.ATTR_NAME) && !attrName.equals(OASISCatalogConstants.ATTR_PUBLIC_ID) && !attrName.equals(OASISCatalogConstants.ATTR_SYSTEM_ID) && !attrName.equals(OASISCatalogConstants.ATTR_CATALOG) && !attrName.equals(OASISCatalogConstants.ATTR_ID)
private void displayConfigElement(CommandInterpreter ci, IConfigurationElement ce, int level) throws Exception { String spacing = spacing(ci, level); ci.println(spacing + '<' + ce.getName() + '>'); String[] attrs = ce.getAttributeNames(); for (int k = 0; k < attrs.length; k++) ci.println(indent + spacing + attrs[k] + " = " + ce.getAttribute(attrs[k])); //$NON-NLS-1$ String value = ce.getValue(); if (value != null) ci.println(indent + spacing + value); IConfigurationElement[] children = ce.getChildren(); for (int z = 0; z < children.length; z++) displayConfigElement(ci, children[z], level + 1); ci.println(spacing + "</" + ce.getName() + '>'); //$NON-NLS-1$ }
private void displayConfigElement(CommandInterpreter ci, IConfigurationElement ce, int level) throws Exception { String spacing = spacing(ci, level); ci.println(spacing + '<' + ce.getName() + '>'); String[] attrs = ce.getAttributeNames(); for (int k = 0; k < attrs.length; k++) ci.println(indent + spacing + attrs[k] + " = " + ce.getAttribute(attrs[k])); //$NON-NLS-1$ String value = ce.getValue(); if (value != null) ci.println(indent + spacing + value); IConfigurationElement[] children = ce.getChildren(); for (int z = 0; z < children.length; z++) displayConfigElement(ci, children[z], level + 1); ci.println(spacing + "</" + ce.getName() + '>'); //$NON-NLS-1$ }
private void displayConfigElement(CommandInterpreter ci, IConfigurationElement ce, int level) throws Exception { String spacing = spacing(ci, level); ci.println(spacing + '<' + ce.getName() + '>'); String[] attrs = ce.getAttributeNames(); for (int k = 0; k < attrs.length; k++) ci.println(indent + spacing + attrs[k] + " = " + ce.getAttribute(attrs[k])); //$NON-NLS-1$ String value = ce.getValue(); if (value != null) ci.println(indent + spacing + value); IConfigurationElement[] children = ce.getChildren(); for (int z = 0; z < children.length; z++) displayConfigElement(ci, children[z], level + 1); ci.println(spacing + "</" + ce.getName() + '>'); //$NON-NLS-1$ }
private void displayConfigElement(CommandInterpreter ci, IConfigurationElement ce, int level) throws Exception { String spacing = spacing(ci, level); ci.println(spacing + '<' + ce.getName() + '>'); String[] attrs = ce.getAttributeNames(); for (int k = 0; k < attrs.length; k++) ci.println(indent + spacing + attrs[k] + " = " + ce.getAttribute(attrs[k])); //$NON-NLS-1$ String value = ce.getValue(); if (value != null) ci.println(indent + spacing + value); IConfigurationElement[] children = ce.getChildren(); for (int z = 0; z < children.length; z++) displayConfigElement(ci, children[z], level + 1); ci.println(spacing + "</" + ce.getName() + '>'); //$NON-NLS-1$ }
for (String attributeName : member.getAttributeNames()) { props.put(attributeName, member.getAttribute(attributeName));
protected Object[] createChildren() { IConfigurationElement config = (IConfigurationElement) getObject(); String[] atts = config.getAttributeNames(); IConfigurationAttribute[] catts = new IConfigurationAttribute[atts.length]; for (int i = 0; i < atts.length; i++) catts[i] = new ConfigurationAttribute(atts[i], config.getAttribute(atts[i])); IConfigurationElement[] children = config.getChildren(); Object[] result = new Object[children.length + catts.length]; for (int i = 0; i < children.length; i++) { IConfigurationElement child = children[i]; result[i] = new ConfigurationElementAdapter(child); } for (int i = 0; i < catts.length; i++) { IConfigurationAttribute child = catts[i]; result[children.length + i] = new ConfigurationAttributeAdapter(child); } return result; } }
private static Map<String, Object> collectAttributes(final IConfigurationElement config) { final Map<String, Object> map = new HashMap<String, Object>(); try { final IExtension extension = config.getDeclaringExtension(); // use @ to avoid conflicting with attributes in the XML safePut(map, "@id", extension.getUniqueIdentifier()); safePut(map, "@label", extension.getLabel()); safePut(map, "@contributor", config.getContributor()); safePut(map, "@namespace", config.getNamespaceIdentifier()); safePut(map, "@point", extension.getExtensionPointUniqueIdentifier()); // similarly use () to avoid conflicts safePut(map, "name()", config.getName()); safePut(map, "text()", config.getValue()); // now load the actual attributes from the XML for (final String key : config.getAttributeNames()) { safePut(map, key, config.getAttribute(key)); } } catch (final InvalidRegistryObjectException re) { map.clear(); // invalid, so wipe slate clean } return unmodifiableMap(map); }