use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class AssignShortcutAction method isIgnoredProject.
private static boolean isIgnoredProject(DataContext context) {
final MavenProject project = MavenActionUtil.getMavenProject(context);
if (project == null)
return false;
final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
return projectsManager != null && projectsManager.isIgnored(project);
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenBeforeRunTasksProvider method configureTask.
public boolean configureTask(RunConfiguration runConfiguration, MavenBeforeRunTask task) {
MavenEditGoalDialog dialog = new MavenEditGoalDialog(myProject);
dialog.setTitle(TasksBundle.message("maven.tasks.select.goal.title"));
if (task.getGoal() == null) {
// just created empty task.
MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(myProject);
List<MavenProject> rootProjects = projectsManager.getRootProjects();
if (rootProjects.size() > 0) {
dialog.setSelectedMavenProject(rootProjects.get(0));
} else {
dialog.setSelectedMavenProject(null);
}
} else {
dialog.setGoals(task.getGoal());
MavenProject mavenProject = getMavenProject(task);
if (mavenProject != null) {
dialog.setSelectedMavenProject(mavenProject);
} else {
dialog.setSelectedMavenProject(null);
}
}
if (!dialog.showAndGet()) {
return false;
}
task.setProjectPath(dialog.getWorkDirectory() + "/pom.xml");
task.setGoal(dialog.getGoals());
return true;
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class AddManagedFilesAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final MavenProjectsManager manager = MavenActionUtil.getProjectsManager(e.getDataContext());
if (manager == null)
return;
FileChooserDescriptor singlePomSelection = new FileChooserDescriptor(true, false, false, false, false, true) {
@Override
public boolean isFileSelectable(VirtualFile file) {
return super.isFileSelectable(file) && !manager.isManagedFile(file);
}
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
if (!file.isDirectory() && !MavenActionUtil.isMavenProjectFile(file))
return false;
return super.isFileVisible(file, showHiddenFiles);
}
};
Project project = MavenActionUtil.getProject(e.getDataContext());
VirtualFile fileToSelect = e.getData(CommonDataKeys.VIRTUAL_FILE);
VirtualFile[] files = FileChooser.chooseFiles(singlePomSelection, project, fileToSelect);
if (files.length == 0)
return;
manager.addManagedFilesOrUnignore(Arrays.asList(files));
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenProjectsAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final DataContext context = e.getDataContext();
final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
if (projectsManager == null)
return;
perform(projectsManager, MavenActionUtil.getMavenProjects(context), e);
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenShowEffectivePom method findPomXml.
@Nullable
private static VirtualFile findPomXml(@NotNull DataContext dataContext) {
VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
if (file == null)
return null;
if (file.isDirectory()) {
file = file.findChild("pom.xml");
if (file == null)
return null;
}
MavenProjectsManager manager = MavenActionUtil.getProjectsManager(dataContext);
if (manager == null)
return null;
MavenProject mavenProject = manager.findProject(file);
if (mavenProject == null)
return null;
return file;
}
Aggregations