use of org.jetbrains.idea.maven.dom.model.MavenDomGoal in project intellij-community by JetBrains.
the class MavenPluginDescriptor method processDescriptors.
public static boolean processDescriptors(Processor<MavenPluginDescriptor> processor, MavenDomConfiguration cfg) {
Map<String, Map<String, Map<String, List<MavenPluginDescriptor>>>> map = getDescriptorsMap();
DomElement parent = cfg.getParent();
MavenDomPlugin plugin = DomUtil.getParentOfType(parent, MavenDomPlugin.class, false);
if (plugin == null)
return true;
Map<String, Map<String, List<MavenPluginDescriptor>>> groupMap = map.get(plugin.getArtifactId().getStringValue());
if (groupMap == null)
return true;
Map<String, List<MavenPluginDescriptor>> goalsMap = groupMap.get(plugin.getGroupId().getStringValue());
if (goalsMap == null)
return true;
List<MavenPluginDescriptor> descriptorsForAllGoals = goalsMap.get(null);
if (descriptorsForAllGoals != null) {
for (MavenPluginDescriptor descriptor : descriptorsForAllGoals) {
if (!processor.process(descriptor))
return false;
}
}
if (parent instanceof MavenDomPluginExecution) {
for (MavenDomGoal goal : ((MavenDomPluginExecution) parent).getGoals().getGoals()) {
List<MavenPluginDescriptor> descriptors = goalsMap.get(goal.getStringValue());
if (descriptors != null) {
for (MavenPluginDescriptor descriptor : descriptors) {
if (!processor.process(descriptor))
return false;
}
}
}
}
return true;
}
use of org.jetbrains.idea.maven.dom.model.MavenDomGoal in project intellij-community by JetBrains.
the class MavenGoalsPresentationProvider method getName.
@Nullable
@Override
public String getName(MavenDomGoals mavenDomGoals) {
StringBuilder res = new StringBuilder("Goals");
boolean hasGoals = false;
for (MavenDomGoal mavenDomGoal : mavenDomGoals.getGoals()) {
String goal = mavenDomGoal.getStringValue();
if (!StringUtil.isEmptyOrSpaces(goal)) {
if (hasGoals) {
res.append(", ");
} else {
res.append(" (");
hasGoals = true;
}
res.append(goal);
}
}
if (hasGoals) {
res.append(")");
}
return res.toString();
}
Aggregations