use of org.jdom.Element in project intellij-community by JetBrains.
the class XDebuggerWatchesProvider method saveContext.
@Override
public void saveContext(Element toElement) throws WriteExternalException {
XDebuggerWatchesManager.WatchesManagerState state = myWatchesManager.getState();
Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
@Override
public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
return accessor.read(bean) != null;
}
});
toElement.addContent(serialize.removeContent());
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class TaskManagerImpl method loadState.
public void loadState(Config config) {
XmlSerializerUtil.copyBean(config, myConfig);
myRepositories.clear();
Element element = config.servers;
List<TaskRepository> repositories = loadRepositories(element);
myRepositories.addAll(repositories);
myTasks.clear();
for (LocalTaskImpl task : config.tasks) {
if (task.getRepository() == null) {
// restore repository from url
String url = task.getIssueUrl();
if (url != null) {
for (TaskRepository repository : repositories) {
if (repository.getUrl() != null && url.startsWith(repository.getUrl())) {
task.setRepository(repository);
}
}
}
}
addTask(task);
}
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class JiraLegacyApi method processRSS.
private List<Task> processRSS(@NotNull GetMethod method) throws Exception {
// Basic authorization should be enough
int code = myRepository.getHttpClient().executeMethod(method);
if (code != HttpStatus.SC_OK) {
throw new Exception(TaskBundle.message("failure.http.error", code, method.getStatusText()));
}
Element root = new SAXBuilder(false).build(method.getResponseBodyAsStream()).getRootElement();
Element channel = root.getChild("channel");
if (channel != null) {
List<Element> children = channel.getChildren("item");
LOG.debug("Total issues in JIRA RSS feed: " + children.size());
return ContainerUtil.map(children, element -> new JiraSoapTask(element, myRepository));
} else {
LOG.warn("JIRA channel not found");
}
return ContainerUtil.emptyList();
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class PivotalTrackerRepository method findTask.
@Nullable
@Override
public Task findTask(@NotNull final String id) throws Exception {
final String realId = getRealId(id);
if (realId == null)
return null;
final String url = API_URL + "/projects/" + myProjectId + "/stories/" + realId;
LOG.info("Retrieving issue by id: " + url);
final HttpMethod method = doREST(url, HTTPMethod.GET);
final InputStream stream = method.getResponseBodyAsStream();
final Element element = new SAXBuilder(false).build(stream).getRootElement();
return element.getName().equals("story") ? createIssue(element) : null;
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class XsltDocumentationProvider method getUrlFor.
@Nullable
public List<String> getUrlFor(PsiElement psiElement, PsiElement psiElement1) {
if (psiElement instanceof XsltElement)
return null;
final String category;
final String name;
final String tagName = getTagName(psiElement);
if (tagName != null) {
name = tagName;
category = "element";
} else if (psiElement instanceof XPathFunction) {
name = ((XPathFunction) psiElement).getName();
category = "function";
} else if (psiElement instanceof DocElement) {
name = ((DocElement) psiElement).getName();
category = ((DocElement) psiElement).getCategory();
} else {
return null;
}
try {
final Document document = getDocumentationDocument();
final XPath xPath = XPath.newInstance("//x:" + category + "[@name = '" + name + "']");
xPath.addNamespace("x", document.getRootElement().getNamespaceURI());
final Element e = (Element) xPath.selectSingleNode(document);
if (e != null) {
return Collections.singletonList(e.getParentElement().getAttributeValue("base") + e.getAttributeValue("href"));
}
} catch (Exception e) {
Logger.getInstance(getClass().getName()).error(e);
}
return null;
}
Aggregations