use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class RemoveManagedFilesAction method notifyUserIfNeeded.
private static void notifyUserIfNeeded(DataContext context, MavenProjectsManager projectsManager, List<VirtualFile> selectedFiles, VirtualFile pomXml) {
MavenProject mavenProject = projectsManager.findProject(pomXml);
assert mavenProject != null;
MavenProject aggregator = projectsManager.findAggregator(mavenProject);
while (aggregator != null && !projectsManager.isManagedFile(aggregator.getFile())) {
aggregator = projectsManager.findAggregator(aggregator);
}
if (aggregator != null && !selectedFiles.contains(aggregator.getFile())) {
notifyUser(context, mavenProject, aggregator);
}
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class ToggleIgnoredProjectsAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final DataContext context = e.getDataContext();
MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
if (projectsManager == null)
return;
List<MavenProject> projects = MavenActionUtil.getMavenProjects(context);
final Project project = MavenActionUtil.getProject(context);
if (project == null)
return;
if (isIgnoredInSettings(projectsManager, projects)) {
ShowSettingsUtil.getInstance().editConfigurable(project, new MavenIgnoredFilesConfigurable(project));
} else {
projectsManager.setIgnoredState(projects, !isIgnored(projectsManager, projects));
}
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class ToggleIgnoredProjectsAction method update.
@Override
public void update(AnActionEvent e) {
super.update(e);
if (!isAvailable(e))
return;
final DataContext context = e.getDataContext();
MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
if (projectsManager == null)
return;
List<MavenProject> projects = MavenActionUtil.getMavenProjects(context);
if (isIgnoredInSettings(projectsManager, projects)) {
e.getPresentation().setText(ProjectBundle.message("maven.ignore.edit"));
} else if (isIgnored(projectsManager, projects)) {
e.getPresentation().setText(ProjectBundle.message("maven.unignore"));
} else {
e.getPresentation().setText(ProjectBundle.message("maven.ignore"));
}
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenKeymapExtension method createActions.
private static void createActions(Project project, List<MavenProject> mavenProjects) {
ActionManager actionManager = ActionManager.getInstance();
MavenShortcutsManager shortcutsManager = MavenShortcutsManager.getInstance(project);
for (MavenProject eachProject : mavenProjects) {
//noinspection TestOnlyProblems
String actionIdPrefix = getActionPrefix(project, eachProject);
for (MavenGoalAction eachAction : collectActions(eachProject)) {
String id = actionIdPrefix + eachAction.getGoal();
actionManager.unregisterAction(id);
if (shortcutsManager.hasShortcuts(eachProject, eachAction.getGoal())) {
actionManager.registerAction(id, eachAction);
}
}
}
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectNamer method generateNameMap.
//private static Logger LOG = Logger.getInstance(MavenProjectNamer.class);
public static Map<MavenProject, String> generateNameMap(Collection<MavenProject> mavenProjects) {
MultiMap<String, MavenProject> artifactIdMap = new MultiMap<>();
for (MavenProject project : mavenProjects) {
artifactIdMap.putValue(project.getMavenId().getArtifactId(), project);
}
Map<MavenProject, String> res = new THashMap<>();
for (Map.Entry<String, Collection<MavenProject>> entry : artifactIdMap.entrySet()) {
List<MavenProject> projectList = (List<MavenProject>) entry.getValue();
String artifactId = entry.getKey();
if (projectList.size() == 1) {
res.put(projectList.get(0), artifactId);
} else if (allGroupsAreDifferent(projectList)) {
for (MavenProject mavenProject : projectList) {
res.put(mavenProject, mavenProject.getMavenId().getGroupId() + ':' + mavenProject.getMavenId().getArtifactId());
}
} else if (allGroupsEqual(mavenProjects)) {
for (MavenProject mavenProject : projectList) {
res.put(mavenProject, mavenProject.getMavenId().getArtifactId() + ':' + mavenProject.getMavenId().getVersion());
}
} else {
for (MavenProject mavenProject : projectList) {
MavenId mavenId = mavenProject.getMavenId();
res.put(mavenProject, mavenId.getGroupId() + ':' + mavenId.getArtifactId() + ':' + mavenId.getVersion());
}
}
}
return res;
}
Aggregations