Search in sources :

Example 6 with TaskView

use of org.gradle.foundation.TaskView in project gradle by gradle.

the class TaskTreeTab method addSelectedToFavorites.

/**
     * Adds whatever is selected to the favorites.
     */
private void addSelectedToFavorites() {
    List<TaskView> tasks = treeComponent.getSelectedTasks();
    gradlePluginLord.getFavoritesEditor().addMutlipleFavorites(tasks, false, new SwingAddMultipleFavoritesInteraction(SwingUtilities.getWindowAncestor(mainPanel)));
}
Also used : TaskView(org.gradle.foundation.TaskView) SwingAddMultipleFavoritesInteraction(org.gradle.gradleplugin.userinterface.swing.generic.SwingAddMultipleFavoritesInteraction)

Example 7 with TaskView

use of org.gradle.foundation.TaskView in project gradle by gradle.

the class TaskTreeTab method executeDefaultTasksInProject.

/**
     * This executes all default tasks in the specified project.
     *
     * @param project the project to execute.
     */
private void executeDefaultTasksInProject(ProjectView project) {
    Iterator<TaskView> iterator = project.getDefaultTasks().iterator();
    while (iterator.hasNext()) {
        TaskView task = iterator.next();
        gradlePluginLord.addExecutionRequestToQueue(task, false);
    }
}
Also used : TaskView(org.gradle.foundation.TaskView)

Example 8 with TaskView

use of org.gradle.foundation.TaskView in project gradle by gradle.

the class AllProjectsAndTasksVisitor method visitTasks.

/*
       Add the list of tasks to the parent tree node.
    */
private static <P, T> List<T> visitTasks(Visitor<P, T> visitor, ProjectAndTaskFilter filter, ProjectView project, P userProjectObject) {
    List<T> taskObjects = new ArrayList<T>();
    Iterator<TaskView> iterator = project.getTasks().iterator();
    while (iterator.hasNext()) {
        TaskView task = iterator.next();
        if (filter.doesAllowTask(task)) {
            T taskObject = visitor.visitTask(task, project, userProjectObject);
            taskObjects.add(taskObject);
        }
    }
    return taskObjects;
}
Also used : TaskView(org.gradle.foundation.TaskView) ArrayList(java.util.ArrayList)

Example 9 with TaskView

use of org.gradle.foundation.TaskView in project gradle by gradle.

the class FavoritesEditor method addMutlipleFavorites.

/**
     * Call this to add tasks as favorites. If you pass in multiple tasks, we'll prompt the user whether or not the tasks should be added as one favorite with multiple tasks or separate tasks.
     *
     * @param tasks the tasks to add. Their order in the list becomes the order in the single task if the user chooses this.
     * @param interaction how we interact with the user or other UI.
     */
public void addMutlipleFavorites(List<TaskView> tasks, boolean alwaysShowOutput, AddMultipleFavoritesInteraction interaction) {
    if (tasks.isEmpty()) {
        return;
    }
    if (tasks.size() == 1) {
        //only 1 task. just add it
        addFavorite(tasks.get(0), alwaysShowOutput);
        return;
    }
    //multiple tasks. Ask the user what to do
    String singleCommandLine = CommandLineAssistant.combineTasks(tasks);
    //prompt the user what to do
    AddMultipleResult addMultipleResult = interaction.promptUserToCombineTasks(tasks, singleCommandLine);
    switch(addMultipleResult) {
        case Cancel:
            return;
        case AddSeparately:
            Iterator<TaskView> iterator = tasks.iterator();
            while (iterator.hasNext()) {
                TaskView task = iterator.next();
                addFavorite(task, alwaysShowOutput);
            }
            break;
        case AddAsSingleCommand:
            addFavorite(singleCommandLine, alwaysShowOutput);
            break;
    }
}
Also used : TaskView(org.gradle.foundation.TaskView)

Example 10 with TaskView

use of org.gradle.foundation.TaskView in project gradle by gradle.

the class BasicFilterEditor method hideTasks.

public void hideTasks(List<TaskView> filteredTasks) {
    Iterator<TaskView> iterator = filteredTasks.iterator();
    while (iterator.hasNext()) {
        TaskView taskView = iterator.next();
        if (!filteredOutTaskNames.contains(taskView.getName())) {
            filteredOutTaskNames.add(taskView.getName());
        }
    }
    notifyChanges();
}
Also used : TaskView(org.gradle.foundation.TaskView)

Aggregations

TaskView (org.gradle.foundation.TaskView)11 ArrayList (java.util.ArrayList)2 SwingAddMultipleFavoritesInteraction (org.gradle.gradleplugin.userinterface.swing.generic.SwingAddMultipleFavoritesInteraction)2 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1 ProjectView (org.gradle.foundation.ProjectView)1 ObserverLord (org.gradle.foundation.common.ObserverLord)1 AlternateUIInteraction (org.gradle.gradleplugin.userinterface.AlternateUIInteraction)1 TaskTreeComponent (org.gradle.gradleplugin.userinterface.swing.generic.TaskTreeComponent)1 TaskVersion1 (org.gradle.openapi.external.foundation.TaskVersion1)1