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);
}
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);
}
}
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);
}
}
}
}
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);
}
}
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;
}
Aggregations