Search in sources :

Example 1 with TaskView

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

the class TaskTreeTab method createTreePanel.

private Component createTreePanel() {
    treeComponent = new TaskTreeComponent(gradlePluginLord, new TaskTreeComponent.Interaction() {

        public void rightClick(JTree tree, int x, int y) {
            enableThingsAppropriately();
            popupMenu.show(tree, x, y);
        }

        public void taskInvoked(TaskView task, boolean isCtrlKeyDown) {
            if (isCtrlKeyDown) {
                gradlePluginLord.addExecutionRequestToQueue(task, false, "-a");
            } else {
                gradlePluginLord.addExecutionRequestToQueue(task, false);
            }
        }

        public void projectInvoked(ProjectView project) {
            executeDefaultTasksInProject(project);
        }
    });
    treeComponent.getTree().addTreeSelectionListener(new TreeSelectionListener() {

        public void valueChanged(TreeSelectionEvent e) {
            enableThingsAppropriately();
        }
    });
    defaultTreeBackground = treeComponent.getTree().getBackground();
    treeScrollPane = new JScrollPane();
    //change the color to better indicate that
    treeComponent.getTree().setBackground(workingBackgroundColor);
    showTextInViewport("Has not built projects/tasks yet.");
    return treeScrollPane;
}
Also used : TaskView(org.gradle.foundation.TaskView) AlternateUIInteraction(org.gradle.gradleplugin.userinterface.AlternateUIInteraction) SwingAddMultipleFavoritesInteraction(org.gradle.gradleplugin.userinterface.swing.generic.SwingAddMultipleFavoritesInteraction) TreeSelectionListener(javax.swing.event.TreeSelectionListener) ProjectView(org.gradle.foundation.ProjectView) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) TaskTreeComponent(org.gradle.gradleplugin.userinterface.swing.generic.TaskTreeComponent)

Example 2 with TaskView

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

the class TaskTreeTab method getSelectedTaskNames.

/**
     * This puts all the selected task names in a space-delimited String
     *
     * @return a string of all the tasks
     */
private String getSelectedTaskNames() {
    List<TaskView> tasks = treeComponent.getSelectedTasks();
    if (tasks.isEmpty()) {
        return null;
    }
    StringBuilder taskString = new StringBuilder();
    Iterator<TaskView> iterator = tasks.iterator();
    while (iterator.hasNext()) {
        TaskView taskView = iterator.next();
        taskString.append(taskView.getFullTaskName());
        if (iterator.hasNext()) {
            taskString.append(' ');
        }
    }
    return taskString.toString();
}
Also used : TaskView(org.gradle.foundation.TaskView)

Example 3 with TaskView

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

the class TaskWrapper method convertTasks.

/**
     * Converts the list of TaskView objects to TaskVersion1 objects. It just wraps them.
     *
     * @param taskViewList the source tasks
     * @return the tasks wrapped in TaskWrappers.
     */
public static List<TaskVersion1> convertTasks(List<TaskView> taskViewList) {
    List<TaskVersion1> returnTasks = new ArrayList<TaskVersion1>();
    Iterator<TaskView> taskViewIterator = taskViewList.iterator();
    while (taskViewIterator.hasNext()) {
        TaskView taskView = taskViewIterator.next();
        returnTasks.add(new TaskWrapper(taskView));
    }
    return returnTasks;
}
Also used : TaskView(org.gradle.foundation.TaskView) ArrayList(java.util.ArrayList) TaskVersion1(org.gradle.openapi.external.foundation.TaskVersion1)

Example 4 with TaskView

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

the class FavoritesEditor method addFavorites.

/**
     * Call this to add the specified tasks as favorite tasks
     *
     * @param tasks the task to make a favorite.
     */
public void addFavorites(List<TaskView> tasks, boolean alwaysShowOutput) {
    boolean addedFavorite = false;
    Iterator<TaskView> iterator = tasks.iterator();
    while (iterator.hasNext()) {
        TaskView task = iterator.next();
        String fullTaskName = task.getFullTaskName();
        if (this.addFavorite(fullTaskName, alwaysShowOutput) != null) {
            addedFavorite = true;
        }
    }
    if (addedFavorite) {
        //don't notify anyone unless we actually did something.
        favoriteTasksObserverLord.notifyObservers(new ObserverLord.ObserverNotification<FavoritesEditor.FavoriteTasksObserver>() {

            public void notify(FavoritesEditor.FavoriteTasksObserver observer) {
                observer.favoritesChanged();
            }
        });
    }
}
Also used : TaskView(org.gradle.foundation.TaskView) ObserverLord(org.gradle.foundation.common.ObserverLord)

Example 5 with TaskView

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

the class BasicFilterEditor method showTasks.

public void showTasks(List<TaskView> filteredTasks) {
    Iterator<TaskView> iterator = filteredTasks.iterator();
    while (iterator.hasNext()) {
        TaskView taskView = iterator.next();
        filteredOutTaskNames.remove(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