Search in sources :

Example 1 with Element

use of org.jdom.Element in project intellij-leiningen-plugin by derkork.

the class LeiningenRunConfiguration method readExternal.

@Override
public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);
    final Element child = element.getChild("LeiningenRunnerParameters");
    if (child != null) {
        myRunnerParams = XmlSerializer.deserialize(child, LeiningenRunnerParameters.class);
    }
}
Also used : Element(org.jdom.Element)

Example 2 with Element

use of org.jdom.Element in project che by eclipse.

the class MavenWorkspace method addSourcePathFromConfiguration.

private void addSourcePathFromConfiguration(ClasspathHelper helper, MavenProject project, Element configuration, List<String> attributes) {
    if (configuration != null) {
        Element sources = configuration.getChild("sources");
        if (sources != null) {
            for (Object element : sources.getChildren()) {
                final String path = ((Element) element).getTextTrim();
                final IPath projectLocation = project.getProject().getLocation();
                final String projectPath = projectLocation.toOSString();
                final String sourceFolder = path.contains(projectPath) ? path.substring(projectPath.length() + 1) : path;
                helper.addSourceEntry(project.getProject().getFullPath().append(sourceFolder));
                if (!attributes.contains(sourceFolder)) {
                    attributes.add(sourceFolder);
                }
            }
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Element(org.jdom.Element)

Example 3 with Element

use of org.jdom.Element in project freud by LMAX-Exchange.

the class ClassDeclarationJdom method getMethodDeclarationListByNameMap.

private void getMethodDeclarationListByNameMap(final JXPathContext context) {
    List<Element> methodDeclElementList = context.selectNodes("//" + FUNCTION_METHOD_DECL.getName() + "|//" + VOID_METHOD_DECL.getName());
    for (Element methodElement : methodDeclElementList) {
        MethodDeclaration methodDeclaration = new MethodDeclarationJdom(methodElement, this);
        final String name = methodDeclaration.getName();
        List<MethodDeclaration> methodDeclarationList = methodDeclarationListByNameMap.get(name);
        if (methodDeclarationList == null) {
            methodDeclarationList = new LinkedList<MethodDeclaration>();
            methodDeclarationListByNameMap.put(name, methodDeclarationList);
        }
        methodDeclarationList.add(methodDeclaration);
    }
}
Also used : MethodDeclaration(org.freud.analysed.javasource.MethodDeclaration) Element(org.jdom.Element)

Example 4 with Element

use of org.jdom.Element in project freud by LMAX-Exchange.

the class ClassDeclarationJdom method getSuperClassName.

public String getSuperClassName() {
    if (superClassName == NOT_RETRIEVED) {
        JXPathContext context = JXPathContext.newContext(classDeclElement);
        final Element superClassElement = (Element) context.selectSingleNode("/" + EXTENDS_CLAUSE.getName() + "//" + IDENT.getName());
        superClassName = (null == superClassElement) ? null : superClassElement.getValue();
    }
    return superClassName;
}
Also used : JXPathContext(org.apache.commons.jxpath.JXPathContext) Element(org.jdom.Element)

Example 5 with Element

use of org.jdom.Element in project freud by LMAX-Exchange.

the class CodeBlockJdom method getMethodCallByMethodNameMap.

@Override
@SuppressWarnings("unchecked")
public Map<String, List<MethodCall>> getMethodCallByMethodNameMap() {
    if (methodCallByMethodNameMap == null) {
        methodCallByMethodNameMap = new HashMap<String, List<MethodCall>>();
        JXPathContext context = JXPathContext.newContext(codeBlockElement);
        List<Element> methodCallElementList = context.selectNodes("//" + JavaSourceTokenType.METHOD_CALL.getName());
        for (Element methodCallElement : methodCallElementList) {
            final MethodCall methodCall = new MethodCallJdom(methodCallElement);
            List<MethodCall> methodCallList = methodCallByMethodNameMap.get(methodCall.getMethodName());
            if (methodCallList == null) {
                methodCallList = new LinkedList<MethodCall>();
                methodCallByMethodNameMap.put(methodCall.getMethodName(), methodCallList);
            }
            methodCallList.add(methodCall);
        }
    }
    return methodCallByMethodNameMap;
}
Also used : JXPathContext(org.apache.commons.jxpath.JXPathContext) Element(org.jdom.Element) List(java.util.List) LinkedList(java.util.LinkedList) MethodCall(org.freud.analysed.javasource.MethodCall)

Aggregations

Element (org.jdom.Element)1236 NotNull (org.jetbrains.annotations.NotNull)103 Nullable (org.jetbrains.annotations.Nullable)98 IOException (java.io.IOException)81 ArrayList (java.util.ArrayList)76 List (java.util.List)70 VirtualFile (com.intellij.openapi.vfs.VirtualFile)67 Document (org.jdom.Document)67 File (java.io.File)64 JDOMException (org.jdom.JDOMException)53 PsiElement (com.intellij.psi.PsiElement)44 SAXBuilder (org.jdom.input.SAXBuilder)40 Attribute (org.jdom.Attribute)32 Iterator (java.util.Iterator)31 InvalidDataException (com.intellij.openapi.util.InvalidDataException)30 WriteExternalException (com.intellij.openapi.util.WriteExternalException)30 THashMap (gnu.trove.THashMap)30 XMLOutputter (org.jdom.output.XMLOutputter)27 JpsElement (org.jetbrains.jps.model.JpsElement)24 NonNls (org.jetbrains.annotations.NonNls)22