Search in sources :

Example 46 with Element

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;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Element(org.jdom.Element) IllegalNameException(org.jdom.IllegalNameException)

Example 47 with Element

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");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Element(org.jdom.Element)

Example 48 with Element

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;
}
Also used : Element(org.jdom.Element) LinkedHashMap(com.intellij.util.containers.hash.LinkedHashMap) Map(java.util.Map)

Example 49 with Element

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

Example 50 with Element

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()]);
}
Also used : XPath(org.jdom.xpath.XPath) SAXBuilder(org.jdom.input.SAXBuilder) TasksIcons(icons.TasksIcons) DatatypeConfigurationException(javax.xml.datatype.DatatypeConfigurationException) Tag(com.intellij.util.xmlb.annotations.Tag) StringUtil(com.intellij.openapi.util.text.StringUtil) Date(java.util.Date) NotNullFunction(com.intellij.util.NotNullFunction) BaseRepository(com.intellij.tasks.impl.BaseRepository) PostMethod(org.apache.commons.httpclient.methods.PostMethod) DatatypeFactory(javax.xml.datatype.DatatypeFactory) ContainerUtil(com.intellij.util.containers.ContainerUtil) BaseRepositoryImpl(com.intellij.tasks.impl.BaseRepositoryImpl) XPath(org.jdom.xpath.XPath) Nullable(org.jetbrains.annotations.Nullable) Document(org.jdom.Document) List(java.util.List) Comparing(com.intellij.openapi.util.Comparing) com.intellij.tasks(com.intellij.tasks) PasswordUtil(com.intellij.openapi.util.PasswordUtil) Logger(com.intellij.openapi.diagnostic.Logger) NotNull(org.jetbrains.annotations.NotNull) Element(org.jdom.Element) javax.swing(javax.swing) SAXBuilder(org.jdom.input.SAXBuilder) PostMethod(org.apache.commons.httpclient.methods.PostMethod) Element(org.jdom.Element) List(java.util.List) Document(org.jdom.Document) DatatypeConfigurationException(javax.xml.datatype.DatatypeConfigurationException)

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