Search in sources :

Example 61 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class FileAssociationsManagerImpl method readExternal.

@SuppressWarnings({ "unchecked" })
public void readExternal(Element element) throws InvalidDataException {
    final List<Element> children = element.getChildren("file");
    for (Element child : children) {
        final String url = child.getAttributeValue("url");
        if (url != null) {
            final VirtualFilePointer pointer = myFilePointerManager.create(url, myProject, null);
            final VirtualFilePointerContainer container = myFilePointerManager.createContainer(myProject);
            container.readExternal(child, "association");
            myAssociations.put(pointer, container);
        }
    }
}
Also used : Element(org.jdom.Element) VirtualFilePointer(com.intellij.openapi.vfs.pointers.VirtualFilePointer) VirtualFilePointerContainer(com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer)

Example 62 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class MavenProjectReader method collectProfilesFromSettingsXmlOrProfilesXml.

private void collectProfilesFromSettingsXmlOrProfilesXml(VirtualFile profilesFile, String rootElementName, boolean wrapRootIfNecessary, String profilesSource, List<MavenProfile> result, Set<String> alwaysOnProfiles, Collection<MavenProjectProblem> problems) {
    Element rootElement = readXml(profilesFile, problems, MavenProjectProblem.ProblemType.SETTINGS_OR_PROFILES);
    if (rootElement == null)
        return;
    if (wrapRootIfNecessary && !rootElementName.equals(rootElement.getName())) {
        Element wrapper = new Element(rootElementName);
        wrapper.addContent(rootElement);
        rootElement = wrapper;
    }
    List<Element> xmlProfiles = MavenJDOMUtil.findChildrenByPath(rootElement, "profiles", "profile");
    collectProfiles(xmlProfiles, result, profilesSource);
    alwaysOnProfiles.addAll(MavenJDOMUtil.findChildrenValuesByPath(rootElement, "activeProfiles", "activeProfile"));
}
Also used : Element(org.jdom.Element)

Example 63 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class MavenProjectReader method readModelBody.

private static void readModelBody(MavenModelBase mavenModelBase, MavenBuildBase mavenBuildBase, Element xmlModel) {
    mavenModelBase.setModules(MavenJDOMUtil.findChildrenValuesByPath(xmlModel, "modules", "module"));
    collectProperties(MavenJDOMUtil.findChildByPath(xmlModel, "properties"), mavenModelBase);
    Element xmlBuild = MavenJDOMUtil.findChildByPath(xmlModel, "build");
    mavenBuildBase.setFinalName(MavenJDOMUtil.findChildValueByPath(xmlBuild, "finalName"));
    mavenBuildBase.setDefaultGoal(MavenJDOMUtil.findChildValueByPath(xmlBuild, "defaultGoal"));
    mavenBuildBase.setDirectory(MavenJDOMUtil.findChildValueByPath(xmlBuild, "directory"));
    mavenBuildBase.setResources(collectResources(MavenJDOMUtil.findChildrenByPath(xmlBuild, "resources", "resource")));
    mavenBuildBase.setTestResources(collectResources(MavenJDOMUtil.findChildrenByPath(xmlBuild, "testResources", "testResource")));
    mavenBuildBase.setFilters(MavenJDOMUtil.findChildrenValuesByPath(xmlBuild, "filters", "filter"));
    if (mavenBuildBase instanceof MavenBuild) {
        MavenBuild mavenBuild = (MavenBuild) mavenBuildBase;
        String source = MavenJDOMUtil.findChildValueByPath(xmlBuild, "sourceDirectory");
        if (!isEmptyOrSpaces(source))
            mavenBuild.addSource(source);
        String testSource = MavenJDOMUtil.findChildValueByPath(xmlBuild, "testSourceDirectory");
        if (!isEmptyOrSpaces(testSource))
            mavenBuild.addTestSource(testSource);
        mavenBuild.setOutputDirectory(MavenJDOMUtil.findChildValueByPath(xmlBuild, "outputDirectory"));
        mavenBuild.setTestOutputDirectory(MavenJDOMUtil.findChildValueByPath(xmlBuild, "testOutputDirectory"));
    }
}
Also used : Element(org.jdom.Element)

Example 64 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class MavenProjectReader method collectProperties.

private static void collectProperties(Element xmlProperties, MavenModelBase mavenModelBase) {
    if (xmlProperties == null)
        return;
    Properties props = mavenModelBase.getProperties();
    for (Element each : xmlProperties.getChildren()) {
        String name = each.getName();
        String value = each.getTextTrim();
        if (!props.containsKey(name) && !isEmptyOrSpaces(name)) {
            props.setProperty(name, value);
        }
    }
}
Also used : Element(org.jdom.Element)

Example 65 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class MavenProject method getProcMode.

@NotNull
public ProcMode getProcMode() {
    Element compilerConfiguration = getPluginExecutionConfiguration("org.apache.maven.plugins", "maven-compiler-plugin", "default-compile");
    if (compilerConfiguration == null) {
        compilerConfiguration = getCompilerConfig();
    }
    if (compilerConfiguration == null) {
        return ProcMode.BOTH;
    }
    Element procElement = compilerConfiguration.getChild("proc");
    if (procElement != null) {
        String procMode = procElement.getValue();
        return ("only".equalsIgnoreCase(procMode)) ? ProcMode.ONLY : ("none".equalsIgnoreCase(procMode)) ? ProcMode.NONE : ProcMode.BOTH;
    }
    String compilerArgument = compilerConfiguration.getChildTextTrim("compilerArgument");
    if ("-proc:none".equals(compilerArgument)) {
        return ProcMode.NONE;
    }
    if ("-proc:only".equals(compilerArgument)) {
        return ProcMode.ONLY;
    }
    Element compilerArguments = compilerConfiguration.getChild("compilerArgs");
    if (compilerArguments != null) {
        for (Element element : compilerArguments.getChildren()) {
            String arg = element.getValue();
            if ("-proc:none".equals(arg)) {
                return ProcMode.NONE;
            }
            if ("-proc:only".equals(arg)) {
                return ProcMode.ONLY;
            }
        }
    }
    return ProcMode.BOTH;
}
Also used : Element(org.jdom.Element) NotNull(org.jetbrains.annotations.NotNull)

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