use of org.jdom.Attribute in project intellij-plugins by JetBrains.
the class JstdRunSettingsSerializationUtils method readFilesExcludedFromCoverage.
@SuppressWarnings("unchecked")
private static List<String> readFilesExcludedFromCoverage(@NotNull Element root) {
List<String> excludedPaths = Lists.newArrayList();
Element coverageElement = root.getChild(Key.COVERAGE.getKey());
if (coverageElement != null) {
List<Element> excludedElements = coverageElement.getChildren(Key.COVERAGE_EXCLUDED.getKey());
for (Element excludedElement : excludedElements) {
Attribute pathAttr = excludedElement.getAttribute(Key.COVERAGE_EXCLUDED_PATH.getKey());
if (pathAttr != null) {
String path = pathAttr.getValue();
if (StringUtil.isNotEmpty(path)) {
excludedPaths.add(FileUtil.toSystemDependentName(path));
}
}
}
}
return excludedPaths;
}
use of org.jdom.Attribute in project intellij-plugins by JetBrains.
the class FlashBuilderSdkFinder method initSdksConfiguredInWorkspace.
private boolean initSdksConfiguredInWorkspace(final String fbWorkspacePath) {
final Element sdkInfoDocument = loadSdkInfoDocument(fbWorkspacePath);
if (sdkInfoDocument == null) {
return false;
}
final Element sdksElement = sdkInfoDocument;
if (!sdksElement.getName().equals(SDKS_ELEMENT))
return false;
//noinspection unchecked
for (final Element sdkElement : sdksElement.getChildren(SDK_ELEMENT)) {
final Attribute defaultSdkAttr = sdkElement.getAttribute(DEFAULT_SDK_ATTR);
final Attribute sdkNameAttr = sdkElement.getAttribute(SDK_NAME_ATTR);
final Attribute sdkLocationAttr = sdkElement.getAttribute(SDK_LOCATION_ATTR);
if (sdkLocationAttr != null) {
if (defaultSdkAttr != null && defaultSdkAttr.getValue().equalsIgnoreCase("true")) {
mySdkNameToRootPath.put(DEFAULT_SDK_NAME, FileUtil.toSystemIndependentName(sdkLocationAttr.getValue()));
}
if (sdkNameAttr != null) {
mySdkNameToRootPath.put(sdkNameAttr.getValue(), FileUtil.toSystemIndependentName(sdkLocationAttr.getValue()));
}
}
}
return true;
}
use of org.jdom.Attribute in project intellij-plugins by JetBrains.
the class SplitTextEditorProvider method readState.
@NotNull
@Override
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
Element child = sourceElement.getChild(FIRST_EDITOR);
FileEditorState firstState = null;
if (child != null) {
firstState = myFirstProvider.readState(child, project, file);
}
child = sourceElement.getChild(SECOND_EDITOR);
FileEditorState secondState = null;
if (child != null) {
secondState = mySecondProvider.readState(child, project, file);
}
final Attribute attribute = sourceElement.getAttribute(SPLIT_LAYOUT);
final String layoutName;
if (attribute != null) {
layoutName = attribute.getValue();
} else {
layoutName = null;
}
return new SplitFileEditor.MyFileEditorState(layoutName, firstState, secondState);
}
use of org.jdom.Attribute in project beast-mcmc by beast-dev.
the class GraphMLUtils method dotFormat.
public static String dotFormat(Element graphElement) {
StringBuilder sb = new StringBuilder();
String graphName = graphElement.getAttributeValue(ARGModel.ID_ATTRIBUTE);
sb.append(GRAPH_NAME);
space(sb);
if (graphName != null) {
sb.append(graphName);
space(sb);
}
startSection(sb);
newLine(sb);
tab(sb);
sb.append(ARGModel.GRAPH_SIZE);
endLine(sb);
// newLine(sb);
tab(sb);
sb.append(ARGModel.DOT_EDGE_DEF);
endLine(sb);
// newLine(sb);
tab(sb);
sb.append(ARGModel.DOT_NODE_DEF);
endLine(sb);
// Fill in graph details
List<Element> nodeList = graphElement.getChildren(ARGModel.NODE_ELEMENT);
List<String> tipNames = new ArrayList<String>();
for (Element nodeElement : nodeList) {
String nodeName = nodeElement.getAttributeValue(ARGModel.ID_ATTRIBUTE);
tab(sb);
sb.append(nodeName);
List<Attribute> attributes = nodeElement.getAttributes();
int cnt = 1;
boolean started = false;
boolean isTip = false;
int length = attributes.size();
for (Attribute attribute : attributes) {
String name = attribute.getName();
if (name.compareTo(ARGModel.ID_ATTRIBUTE) != 0) {
if (name.compareTo(ARGModel.IS_TIP) == 0) {
isTip = true;
try {
if (attribute.getBooleanValue()) {
tipNames.add(nodeName);
}
} catch (DataConversionException e) {
//To change body of catch statement use File | Settings | File Templates.
e.printStackTrace();
}
cnt++;
} else {
if (!ignore(name)) {
if (!started) {
space(sb);
startAttribute(sb);
started = true;
} else
nextAttribute(sb);
sb.append(translate(name) + "=" + attribute.getValue());
cnt++;
// if (cnt < length)
// nextAttribute(sb);
// else {
// }
}
}
}
}
if (!isTip) {
if (!started) {
space(sb);
startAttribute(sb);
started = true;
} else {
nextAttribute(sb);
}
sb.append("label=\"\",shape=circle,height=0.02,width=0.2,fontsize=1");
}
if (started) {
endAttribute(sb);
}
// if (!isTip) {
//
// }
endLine(sb);
}
List<Element> edgeList = graphElement.getChildren(ARGModel.EDGE_ELEMENT);
for (Element edgeElement : edgeList) {
String fromName = edgeElement.getAttributeValue(ARGModel.EDGE_FROM);
String toName = edgeElement.getAttributeValue(ARGModel.EDGE_TO);
tab(sb);
sb.append(fromName + " -> " + toName);
String edgeLength = edgeElement.getAttributeValue(ARGModel.EDGE_LENGTH);
if (edgeLength != null && printLengths) {
space(sb);
startAttribute(sb);
sb.append(ARGModel.EDGE_LENGTH + "=" + edgeLength + ",weight=1000.0");
endAttribute(sb);
}
String partitions = edgeElement.getAttributeValue(ARGModel.EDGE_PARTITIONS);
if (partitions != null) {
space(sb);
startAttribute(sb);
sb.append("label=\"" + partitions + "\"");
endAttribute(sb);
}
endLine(sb);
}
//newLine(sb);
if (tipNames.size() > 0) {
tab(sb);
startSection(sb);
sb.append("rank=same;");
for (String name : tipNames) {
space(sb);
sb.append(name);
}
endSection(sb);
newLine(sb);
}
endSection(sb);
return sb.toString();
}
use of org.jdom.Attribute in project che by eclipse.
the class JdomUtil method getHash.
private static int getHash(int hash, Element element) {
hash = sumHash(hash, element.getName());
for (Object object : element.getAttributes()) {
Attribute attribute = (Attribute) object;
hash = sumHash(hash, attribute.getName());
hash = sumHash(hash, attribute.getValue());
}
for (Object o : element.getContent()) {
if (o instanceof Element) {
hash = getHash(hash, (Element) o);
} else if (o instanceof Text) {
String text = ((Text) o).getText();
if (!isNullOrWhitespace(text)) {
hash = sumHash(hash, text);
}
}
}
return hash;
}
Aggregations