Search in sources :

Example 56 with Element

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());
}
Also used : XDebuggerWatchesManager(com.intellij.xdebugger.impl.XDebuggerWatchesManager) SerializationFilter(com.intellij.util.xmlb.SerializationFilter) Element(org.jdom.Element) Accessor(com.intellij.util.xmlb.Accessor)

Example 57 with Element

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);
    }
}
Also used : Element(org.jdom.Element)

Example 58 with Element

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();
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) Element(org.jdom.Element)

Example 59 with Element

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;
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) InputStream(java.io.InputStream) Element(org.jdom.Element) HttpMethod(org.apache.commons.httpclient.HttpMethod) Nullable(org.jetbrains.annotations.Nullable)

Example 60 with Element

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;
}
Also used : XPath(org.jdom.xpath.XPath) XPathFunction(org.intellij.lang.xpath.psi.XPathFunction) XsltElement(org.intellij.lang.xpath.xslt.psi.XsltElement) XsltElement(org.intellij.lang.xpath.xslt.psi.XsltElement) LightElement(com.intellij.psi.impl.light.LightElement) Element(org.jdom.Element) Document(org.jdom.Document) JDOMException(org.jdom.JDOMException) IncorrectOperationException(com.intellij.util.IncorrectOperationException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) IOException(java.io.IOException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Element (org.jdom.Element)1994 BioPaxObject (org.vcell.pathway.BioPaxObject)143 ArrayList (java.util.ArrayList)141 NotNull (org.jetbrains.annotations.NotNull)103 IOException (java.io.IOException)102 Document (org.jdom.Document)102 Nullable (org.jetbrains.annotations.Nullable)98 List (java.util.List)84 File (java.io.File)78 GroupObject (org.vcell.pathway.GroupObject)75 VirtualFile (com.intellij.openapi.vfs.VirtualFile)67 JDOMException (org.jdom.JDOMException)57 Expression (cbit.vcell.parser.Expression)47 SAXBuilder (org.jdom.input.SAXBuilder)47 ExpressionException (cbit.vcell.parser.ExpressionException)45 Iterator (java.util.Iterator)45 PsiElement (com.intellij.psi.PsiElement)44 Attribute (org.jdom.Attribute)42 XMLOutputter (org.jdom.output.XMLOutputter)34 Namespace (org.jdom.Namespace)32