use of org.jdom.Element in project intellij-community by JetBrains.
the class Maven2ModelConverter method xppToElement.
private static Element xppToElement(Xpp3Dom xpp) throws RemoteException {
Element result;
try {
result = new Element(xpp.getName());
} catch (IllegalNameException e) {
Maven2ServerGlobals.getLogger().info(e);
return null;
}
Xpp3Dom[] children = xpp.getChildren();
if (children == null || children.length == 0) {
result.setText(xpp.getValue());
} else {
for (Xpp3Dom each : children) {
Element child = xppToElement(each);
if (child != null)
result.addContent(child);
}
}
return result;
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class LastSelectedPropertiesFileStore method loadState.
@Override
public void loadState(Element state) {
lastSelectedUrls.clear();
for (Element child : state.getChildren("entry")) {
String context = child.getAttributeValue("context");
String url = child.getAttributeValue("url");
VirtualFile propFile = VirtualFileManager.getInstance().findFileByUrl(url);
VirtualFile contextFile = VirtualFileManager.getInstance().findFileByUrl(context);
if (propFile != null && contextFile != null) {
lastSelectedUrls.put(context, url);
}
}
lastSelectedFileUrl = state.getAttributeValue("lastSelectedFileUrl");
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class LastSelectedPropertiesFileStore method getState.
@Override
public Element getState() {
Element state = new Element("state");
for (Map.Entry<String, String> entry : lastSelectedUrls.entrySet()) {
Element child = new Element("entry");
child.setAttribute("context", entry.getKey());
child.setAttribute("url", entry.getValue());
state.addContent(child);
}
if (lastSelectedFileUrl != null) {
state.setAttribute("lastSelectedFileUrl", lastSelectedFileUrl);
}
return state;
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class IncompletePropertyInspection method readSettings.
@Override
public void readSettings(@NotNull Element node) throws InvalidDataException {
mySuffixes.clear();
final Element element = node.getChild(SUFFIXES_TAG_NAME);
if (element != null) {
mySuffixes.addAll(StringUtil.split(element.getText(), ",", true, false));
}
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class FogBugzRepository method getCases.
@SuppressWarnings("unchecked")
private Task[] getCases(String q) throws Exception {
loginIfNeeded();
PostMethod method = new PostMethod(getUrl() + "/api.asp");
method.addParameter("token", myToken);
method.addParameter("cmd", "search");
method.addParameter("q", q);
method.addParameter("cols", "sTitle,fOpen,dtOpened,dtLastUpdated,ixCategory");
int status = getHttpClient().executeMethod(method);
if (status != 200) {
throw new Exception("Error listing cases: " + method.getStatusLine());
}
Document document = new SAXBuilder(false).build(method.getResponseBodyAsStream()).getDocument();
List<Element> errorNodes = XPath.newInstance("/response/error").selectNodes(document);
if (!errorNodes.isEmpty()) {
throw new Exception("Error listing cases: " + errorNodes.get(0).getText());
}
final XPath commentPath = XPath.newInstance("events/event");
final List<Element> nodes = (List<Element>) XPath.newInstance("/response/cases/case").selectNodes(document);
final List<Task> tasks = ContainerUtil.mapNotNull(nodes, (NotNullFunction<Element, Task>) element -> createCase(element, commentPath));
return tasks.toArray(new Task[tasks.size()]);
}
Aggregations