Search in sources :

Example 71 with Element

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

the class MavenResourceCompilerConfigurationGenerator method addEarModelMapEntries.

private static void addEarModelMapEntries(@NotNull MavenProject mavenProject, @NotNull Map<String, String> modelMap) {
    Element pluginConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-ear-plugin");
    final String skinnyWars = MavenJDOMUtil.findChildValueByPath(pluginConfiguration, "skinnyWars", "false");
    modelMap.put("build.plugin.maven-ear-plugin.skinnyWars", skinnyWars);
}
Also used : Element(org.jdom.Element)

Example 72 with Element

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

the class MavenResourceCompilerConfigurationGenerator method addEjbClientArtifactConfiguration.

private static void addEjbClientArtifactConfiguration(Module module, MavenProjectConfiguration projectCfg, MavenProject mavenProject) {
    Element pluginCfg = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-ejb-plugin");
    if (pluginCfg == null || !Boolean.parseBoolean(pluginCfg.getChildTextTrim("generateClient"))) {
        return;
    }
    MavenEjbClientConfiguration ejbClientCfg = new MavenEjbClientConfiguration();
    Element includes = pluginCfg.getChild("clientIncludes");
    if (includes != null) {
        for (Element include : includes.getChildren("clientInclude")) {
            String includeText = include.getTextTrim();
            if (!includeText.isEmpty()) {
                ejbClientCfg.includes.add(includeText);
            }
        }
    }
    Element excludes = pluginCfg.getChild("clientExcludes");
    if (excludes != null) {
        for (Element exclude : excludes.getChildren("clientExclude")) {
            String excludeText = exclude.getTextTrim();
            if (!excludeText.isEmpty()) {
                ejbClientCfg.excludes.add(excludeText);
            }
        }
    }
    if (!ejbClientCfg.isEmpty()) {
        projectCfg.ejbClientArtifactConfigs.put(MavenUtil.getEjbClientArtifactName(module, true), ejbClientCfg);
    }
}
Also used : Element(org.jdom.Element)

Example 73 with Element

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

the class ClientPropertiesManager method checkInitDefaultManager.

private static void checkInitDefaultManager() {
    synchronized (DEFAULT_MANAGER_LOCK) {
        // in Upsource projectOpened can be executed concurrently for 2 projects
        if (ourDefaultManager == null) {
            ourDefaultManager = new ClientPropertiesManager();
            try {
                //noinspection HardCodedStringLiteral
                final Document document = new SAXBuilder().build(ClientPropertiesManager.class.getResource("/" + COMPONENT_NAME + ".xml"));
                final Element child = document.getRootElement();
                ourDefaultManager.readExternal(child);
            } catch (Exception e) {
                LOG.error(e);
            }
        }
    }
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) Element(org.jdom.Element) Document(org.jdom.Document) InvalidDataException(com.intellij.openapi.util.InvalidDataException) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Example 74 with Element

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

the class ClientPropertiesManager method writeExternal.

public void writeExternal(Element element) throws WriteExternalException {
    if (equals(getDefaultManager())) {
        throw new WriteExternalException();
    }
    for (Map.Entry<String, List<ClientProperty>> entry : myPropertyMap.entrySet()) {
        Element propertiesElement = new Element(ELEMENT_PROPERTIES);
        propertiesElement.setAttribute(ATTRIBUTE_CLASS, entry.getKey());
        for (ClientProperty prop : entry.getValue()) {
            Element propertyElement = new Element(ELEMENT_PROPERTY);
            propertyElement.setAttribute(ATTRIBUTE_NAME, prop.getName());
            propertyElement.setAttribute(ATTRIBUTE_CLASS, prop.getValueClass());
            propertiesElement.addContent(propertyElement);
        }
        element.addContent(propertiesElement);
    }
}
Also used : Element(org.jdom.Element) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Example 75 with Element

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

the class MavenFilteredPropertyPsiReferenceProvider method getDelimitersPattern.

@NotNull
public static Pattern getDelimitersPattern(MavenProject mavenProject) {
    Pattern res = mavenProject.getCachedValue(KEY);
    if (res == null) {
        Element cfg = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-resources-plugin");
        if (cfg == null) {
            res = DEFAULT_DELIMITERS;
        } else {
            List<String> delimiters = MavenJDOMUtil.findChildrenValuesByPath(cfg, "delimiters", "delimiter");
            if (delimiters.isEmpty() || delimiters.size() > 10) {
                res = DEFAULT_DELIMITERS;
            } else {
                StringBuilder patternBuilder = new StringBuilder();
                for (String delimiter : delimiters) {
                    delimiter = delimiter.trim();
                    if (delimiter.isEmpty())
                        continue;
                    int ind = delimiter.indexOf('*');
                    if (ind >= 0) {
                        appendDelimiter(patternBuilder, delimiter.substring(0, ind), delimiter.substring(ind + 1));
                    } else {
                        appendDelimiter(patternBuilder, delimiter, delimiter);
                    }
                }
                // <useDefaultDelimiters> is not used if custom delimiters are not present.
                boolean useDefaultDelimiters = true;
                String useDefaultDelimitersText = cfg.getChildText("useDefaultDelimiters");
                if (StringUtil.isNotEmpty(useDefaultDelimitersText)) {
                    useDefaultDelimiters = Boolean.parseBoolean(useDefaultDelimitersText);
                }
                if (useDefaultDelimiters) {
                    appendDelimiter(patternBuilder, "${", "}");
                    appendDelimiter(patternBuilder, "@", "@");
                }
                res = Pattern.compile(patternBuilder.toString());
            }
        }
        res = mavenProject.putCachedValue(KEY, res);
    }
    return res;
}
Also used : Pattern(java.util.regex.Pattern) PsiElement(com.intellij.psi.PsiElement) 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