use of org.jdom.Attribute in project intellij-community by JetBrains.
the class JDOMCompare method diffAttributes.
public static String diffAttributes(Element element1, Element element2, String pathPrefix, String mode) {
for (Object o : element1.getAttributes()) {
final Attribute attr = (Attribute) o;
final String name = attr.getName();
final String value1 = attr.getValue();
final String value2 = element2.getAttributeValue(name);
if (value2 == null) {
return MessageFormat.format("Attribute {2} at {0}/@{1}", pathPrefix, name, mode);
}
if (!value1.equals(value2)) {
return MessageFormat.format("Attribute value mismatch at {0}/@{1}, expected={2}, actual={3}", pathPrefix, name, value1, value2);
}
}
return null;
}
use of org.jdom.Attribute in project intellij-community by JetBrains.
the class PersistentFileSetManager method getState.
@Override
public Element getState() {
final Element root = new Element("root");
for (VirtualFile vf : getSortedFiles()) {
final Element vfElement = new Element(FILE_ELEMENT);
final Attribute filePathAttr = new Attribute(PATH_ATTR, VfsUtilCore.pathToUrl(vf.getPath()));
vfElement.setAttribute(filePathAttr);
root.addContent(vfElement);
}
return root;
}
use of org.jdom.Attribute in project intellij-community by JetBrains.
the class StateSplitterEx method mergeStateInto.
protected static void mergeStateInto(@NotNull Element target, @NotNull Element subState, @NotNull String subStateName) {
if (subState.getName().equals(subStateName)) {
target.addContent(subState);
} else {
for (Iterator<Element> iterator = subState.getChildren().iterator(); iterator.hasNext(); ) {
Element configuration = iterator.next();
iterator.remove();
target.addContent(configuration);
}
for (Iterator<Attribute> iterator = subState.getAttributes().iterator(); iterator.hasNext(); ) {
Attribute attribute = iterator.next();
iterator.remove();
target.setAttribute(attribute);
}
}
}
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());
}
}
}
use of org.jdom.Attribute in project intellij-community by JetBrains.
the class XmlWriter method writeElement.
public void writeElement(final Element element) {
startElement(element.getName());
try {
for (final Object o1 : element.getAttributes()) {
final Attribute attribute = (Attribute) o1;
addAttribute(attribute.getName(), attribute.getValue());
}
for (final Object o : element.getChildren()) {
final Element child = (Element) o;
writeElement(child);
}
} finally {
endElement();
}
}
Aggregations