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