Search in sources :

Example 1 with MavenCompilerTask

use of org.jetbrains.idea.maven.tasks.MavenCompilerTask in project intellij-community by JetBrains.

the class ToggleCompilerTasksAction method getTasks.

protected static List<MavenCompilerTask> getTasks(DataContext context) {
    final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
    if (goals == null || goals.isEmpty())
        return Collections.emptyList();
    MavenProject project = MavenActionUtil.getMavenProject(context);
    if (project == null)
        return Collections.emptyList();
    List<MavenCompilerTask> result = new ArrayList<>();
    for (String each : goals) {
        result.add(new MavenCompilerTask(project.getPath(), each));
    }
    return result;
}
Also used : MavenCompilerTask(org.jetbrains.idea.maven.tasks.MavenCompilerTask) MavenProject(org.jetbrains.idea.maven.project.MavenProject) ArrayList(java.util.ArrayList)

Example 2 with MavenCompilerTask

use of org.jetbrains.idea.maven.tasks.MavenCompilerTask in project intellij-community by JetBrains.

the class ToggleCompilerTasksAction method setSelected.

@Override
public void setSelected(AnActionEvent e, boolean state) {
    final DataContext context = e.getDataContext();
    final MavenTasksManager tasksManager = getTasksManager(context);
    List<MavenCompilerTask> tasks = getTasks(context);
    if (tasksManager == null)
        return;
    if (state) {
        addTasks(tasksManager, tasks);
    } else {
        removeTasks(tasksManager, tasks);
    }
}
Also used : MavenCompilerTask(org.jetbrains.idea.maven.tasks.MavenCompilerTask) DataContext(com.intellij.openapi.actionSystem.DataContext) MavenTasksManager(org.jetbrains.idea.maven.tasks.MavenTasksManager)

Aggregations

MavenCompilerTask (org.jetbrains.idea.maven.tasks.MavenCompilerTask)2 DataContext (com.intellij.openapi.actionSystem.DataContext)1 ArrayList (java.util.ArrayList)1 MavenProject (org.jetbrains.idea.maven.project.MavenProject)1 MavenTasksManager (org.jetbrains.idea.maven.tasks.MavenTasksManager)1