use of org.jdom.Attribute in project freud by LMAX-Exchange.
the class MethodCallJdom method getMethodName.
@SuppressWarnings("unchecked")
public String getMethodName() {
if (methodName == null) {
final Attribute idAttr = methodCallElement.getAttribute(JdomTreeAdaptor.ID_ATTR);
if (idAttr != null) {
methodName = idAttr.getValue();
instanceReferences = EMPTY_ARRAY;
} else {
JXPathContext context = JXPathContext.newContext(methodCallElement);
final List<Element> identElementList = context.selectNodes("//" + JavaSourceTokenType.IDENT.getName());
Collections.sort(identElementList, JdomTreePositionComparator.getInstance());
final int methodNameIndex = identElementList.size() - 1;
methodName = identElementList.get(methodNameIndex).getText();
instanceReferences = new String[methodNameIndex];
for (int i = 0, size = instanceReferences.length; i < size; i++) {
instanceReferences[i] = identElementList.get(i).getText();
}
}
}
return methodName;
}
use of org.jdom.Attribute in project intellij-community by JetBrains.
the class LwXmlReader method getColorDescriptor.
public static ColorDescriptor getColorDescriptor(final Element element) throws Exception {
Attribute attr = element.getAttribute(UIFormXmlConstants.ATTRIBUTE_COLOR);
if (attr != null) {
return new ColorDescriptor(new Color(attr.getIntValue()));
}
String swingColor = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_SWING_COLOR);
if (swingColor != null) {
return ColorDescriptor.fromSwingColor(swingColor);
}
String systemColor = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_SYSTEM_COLOR);
if (systemColor != null) {
return ColorDescriptor.fromSystemColor(systemColor);
}
String awtColor = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_AWT_COLOR);
if (awtColor != null) {
return ColorDescriptor.fromAWTColor(awtColor);
}
return new ColorDescriptor(null);
}
use of org.jdom.Attribute in project intellij-elixir by KronicDeth.
the class MixRunConfigurationBase method readExternal.
@Override
public void readExternal(Element element) throws InvalidDataException {
super.readExternal(element);
XmlSerializer.deserializeInto(this, element);
EnvironmentVariablesComponent.readExternal(element, getEnvs());
/*
* Reading <= 4.6.0 format
*/
List<Element> options = element.getChildren("option");
for (Element option : options) {
Attribute nameAttribute = option.getAttribute("name");
if (nameAttribute.getValue().equals("command")) {
Attribute valueAttribute = option.getAttribute("value");
setProgramParameters(valueAttribute.getValue());
break;
}
}
}
use of org.jdom.Attribute in project intellij-community by JetBrains.
the class DefaultColorSchemesManager method loadState.
@Override
public void loadState(Element state) {
List<DefaultColorsScheme> schemes = new ArrayList<>();
for (Element schemeElement : state.getChildren(SCHEME_ELEMENT)) {
boolean isUpdated = false;
Attribute nameAttr = schemeElement.getAttribute(NAME_ATTR);
if (nameAttr != null) {
for (DefaultColorsScheme oldScheme : mySchemes) {
if (StringUtil.equals(nameAttr.getValue(), oldScheme.getName())) {
oldScheme.readExternal(schemeElement);
schemes.add(oldScheme);
isUpdated = true;
}
}
}
if (!isUpdated) {
DefaultColorsScheme newScheme = new DefaultColorsScheme();
newScheme.readExternal(schemeElement);
schemes.add(newScheme);
}
}
schemes.add(EmptyColorScheme.INSTANCE);
mySchemes = schemes;
}
use of org.jdom.Attribute in project intellij-community by JetBrains.
the class UnknownRunConfiguration method writeExternal.
@Override
public void writeExternal(final Element element) throws WriteExternalException {
if (myStoredElement != null) {
final List attributeList = myStoredElement.getAttributes();
for (Object anAttributeList : attributeList) {
final Attribute a = (Attribute) anAttributeList;
element.setAttribute(a.getName(), a.getValue());
}
final List list = myStoredElement.getChildren();
for (Object child : list) {
final Element c = (Element) child;
element.addContent((Element) c.clone());
}
}
}
Aggregations