use of org.gradle.foundation.ProjectView 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;
}
use of org.gradle.foundation.ProjectView in project gradle by gradle.
the class ProjectWrapper method convertProjects.
/**
* Converts the list of ProjectView objects to ProjectVersion1 objects. It just wraps them.
*
* @param projectViewList the source projects
* @return the projects wrapped in ProjectWrappers.
*/
public static List<ProjectVersion1> convertProjects(List<ProjectView> projectViewList) {
List<ProjectVersion1> returnProjects = new ArrayList<ProjectVersion1>();
if (projectViewList != null) {
Iterator<ProjectView> projectViewIterator = projectViewList.iterator();
while (projectViewIterator.hasNext()) {
ProjectView projectView = projectViewIterator.next();
returnProjects.add(new ProjectWrapper(projectView));
}
}
return returnProjects;
}
use of org.gradle.foundation.ProjectView in project gradle by gradle.
the class AllProjectsAndTasksVisitor method visitProjects.
public static <P, T> List<P> visitProjects(Visitor<P, T> visitor, ProjectAndTaskFilter filter, List<ProjectView> projects, P parentProjectObject) {
List<P> projectObjects = new ArrayList<P>();
Iterator<ProjectView> iterator = projects.iterator();
while (iterator.hasNext()) {
ProjectView project = iterator.next();
if (filter.doesAllowProject(project)) {
P userProjectObject = visitor.visitProject(project, parentProjectObject);
projectObjects.add(userProjectObject);
//visit sub projects
visitProjects(visitor, filter, project.getSubProjects(), userProjectObject);
//visit tasks
visitTasks(visitor, filter, project, userProjectObject);
}
}
return projectObjects;
}
use of org.gradle.foundation.ProjectView in project gradle by gradle.
the class TaskTreePopulationVisitor method visitProjects.
private static <P, T> List<P> visitProjects(Visitor<P, T> visitor, ProjectAndTaskFilter filter, List<ProjectView> sourceProjects, P parentProjectObject, Comparator<ProjectView> projectSorter, Comparator<TaskView> taskSorter) {
List<P> projectObjects = new ArrayList<P>();
//make a copy because we're going to sort them.
sourceProjects = CollectionUtils.sort(sourceProjects, projectSorter);
Iterator<ProjectView> iterator = sourceProjects.iterator();
int index = 0;
while (iterator.hasNext()) {
ProjectView project = iterator.next();
if (filter.doesAllowProject(project)) {
P userProjectObject = visitor.visitProject(project, index, parentProjectObject);
projectObjects.add(userProjectObject);
//visit sub projects
List<P> subProjectObjects = visitProjects(visitor, filter, project.getSubProjects(), userProjectObject, projectSorter, taskSorter);
//visit tasks. Notice that we pass in the number of subprojects as a starting index. This is so they'll come afterwards.
List<T> taskObjects = visitTasks(visitor, filter, project, subProjectObjects.size(), userProjectObject, taskSorter);
visitor.completedVisitingProject(userProjectObject, subProjectObjects, taskObjects);
}
index++;
}
return projectObjects;
}
use of org.gradle.foundation.ProjectView in project gradle by gradle.
the class TaskTreeTab method editSelectedFiles.
/**
* This opens the selected files. This gets the 'parent' of this to do it for us. This facilitates using this inside an IDE (you get the IDE to open it).
*/
private void editSelectedFiles() {
TaskTreeComponent.MultipleSelection tasks = treeComponent.getSelectedProjectsAndTasks();
Iterator<ProjectView> iterator = tasks.projects.iterator();
while (iterator.hasNext()) {
ProjectView projectView = iterator.next();
File file = projectView.getBuildFile();
if (file != null) {
alternateUIInteraction.editFile(file, -1);
}
}
}
Aggregations