private EVTaskDependency chooseTask(String taskListName) {
if (taskListName == null)
return null;
EVTaskList tl = EVTaskList.openExisting(taskListName,
dashboardContext.getData(),
dashboardContext.getHierarchy(), dashboardContext
.getCache(), false);
if (tl == null)
return null;
JTree tree = new JTree(tl);
tree.expandRow(0);
for (int i = tree.getRowCount(); i-- > 0;)
tree.expandRow(i);
tree.setRootVisible(false);
tree.setToggleClickCount(3);
new JOptionPaneClickHandler().install(tree);
tree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION);
JScrollPane scrollPane = new JScrollPane(tree);
scrollPane.setPreferredSize(new Dimension(200, 200));
Object message = new Object[] {
resources.getString("Add.Select_Task_Instructions"),
scrollPane };
int userReponse = JOptionPane.showConfirmDialog(dependencyTable,
message, resources.getString("Add.Window_Title"),
JOptionPane.OK_CANCEL_OPTION);
if (userReponse == JOptionPane.OK_OPTION) {
TreePath path = tree.getSelectionPath();
if (path == null)
return null;
EVTask task = (EVTask) path.getLastPathComponent();
String taskID = EVTaskDependencyResolver.getIdForTask(task,
tl.getID());
System.out.println("taskID is " + taskID);
if (taskID == null)
return null;
EVTaskDependency d = new EVTaskDependency(taskID, task
.getFullName());