Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-01-05 20:32:55 +0000
committermkersten2007-01-05 20:32:55 +0000
commit9c38565581ca3d39010e65972861f2211f62a9ed (patch)
treefd7b62a71eb0aa4728e95f3b1405c43a1abd021c
parenta7db52867d362dfd3c9fa7ea79a9e6b5c5f927b8 (diff)
downloadorg.eclipse.mylyn.tasks-9c38565581ca3d39010e65972861f2211f62a9ed.tar.gz
org.eclipse.mylyn.tasks-9c38565581ca3d39010e65972861f2211f62a9ed.tar.xz
org.eclipse.mylyn.tasks-9c38565581ca3d39010e65972861f2211f62a9ed.zip
RESOLVED - bug 164661: allow adding multiple existing tasks at once via Add Existing Task wizard
https://bugs.eclipse.org/bugs/show_bug.cgi?id=164661
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTask.java29
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java39
2 files changed, 43 insertions, 25 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTask.java
index b124c134c..8df1ffe1e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTask.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTask.java
@@ -29,7 +29,7 @@ import org.eclipse.ui.progress.IProgressService;
public class OpenRepositoryTask extends Action implements IWorkbenchWindowActionDelegate {
private static final String OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS = "org.eclipse.mylar.tasks.ui.open.remote";
-
+
public void run(IAction action) {
RemoteTaskSelectionDialog dlg = new RemoteTaskSelectionDialog(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell());
@@ -66,23 +66,28 @@ public class OpenRepositoryTask extends Action implements IWorkbenchWindowAction
* Selected a repository, so try to obtain the task using id
*/
private void openRemoteTask(RemoteTaskSelectionDialog dlg) {
+ String[] selectedIds = dlg.getSelectedIds();
if (dlg.shouldAddToTaskList()) {
- final IProgressService svc = PlatformUI.getWorkbench().getProgressService();
- final AddExistingTaskJob job = new AddExistingTaskJob(dlg.getSelectedTaskRepository(), dlg.getSelectedId(),
- dlg.getSelectedCategory());
- job.schedule();
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ for (String id : selectedIds) {
+ final IProgressService svc = PlatformUI.getWorkbench().getProgressService();
+ final AddExistingTaskJob job = new AddExistingTaskJob(dlg.getSelectedTaskRepository(), id, dlg
+ .getSelectedCategory());
+ job.schedule();
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- svc.showInDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), job);
- }
+ public void run() {
+ svc.showInDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), job);
+ }
- });
+ });
+ }
} else {
- TasksUiUtil.openRepositoryTask(dlg.getSelectedTaskRepository(), dlg.getSelectedId());
+ for (String id : selectedIds) {
+ TasksUiUtil.openRepositoryTask(dlg.getSelectedTaskRepository(), id);
+ }
}
}
-
+
public void dispose() {
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
index 9c8162bd7..d82f3fbee 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
@@ -111,16 +111,9 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
Composite area = (Composite) super.createDialogArea(parent);
Label idLabel = new Label(area, SWT.NULL);
- idLabel.setText("Enter Key/&ID: ");
+ idLabel.setText("Enter Key/&ID (use comma for multiple): ");
idText = new Text(area, SWT.BORDER);
idText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- idText.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- validate();
- }
-
- });
Label matchingTasksLabel = new Label(area, SWT.NONE);
matchingTasksLabel.setText("&Matching tasks:");
@@ -133,12 +126,22 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (selectedIds == null) {
+ return false;
+ }
+
// Only shows exact task matches
if (!(element instanceof AbstractRepositoryTask)) {
return false;
}
AbstractRepositoryTask task = (AbstractRepositoryTask) element;
- return idText.getText().trim().equals(task.getIdLabel());
+ String taskId = task.getIdLabel();
+ for (String id : selectedIds) {
+ if (id.equals(taskId)) {
+ return true;
+ }
+ }
+ return false;
}
});
@@ -146,6 +149,8 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
idText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
+ computeIds();
+ validate();
tasksViewer.refresh(false);
}
@@ -331,7 +336,7 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
updateStatus(new Status(IStatus.OK, TasksUiPlugin.PLUGIN_ID, 0, "", null));
}
- private String selectedId;
+ private String[] selectedIds;
private TaskRepository selectedRepository;
@@ -341,8 +346,8 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
private AbstractTaskContainer selectedCategory;
- public String getSelectedId() {
- return selectedId;
+ public String[] getSelectedIds() {
+ return selectedIds;
}
public TaskRepository getSelectedTaskRepository() {
@@ -363,7 +368,8 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
@Override
protected void computeResult() {
- selectedId = idText.getText().trim();
+ computeIds();
+
ISelection taskSelection = tasksViewer.getSelection();
if (!taskSelection.isEmpty()) {
selectedTask = (AbstractRepositoryTask) ((IStructuredSelection) taskSelection).getFirstElement();
@@ -378,4 +384,11 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
}
}
+ private void computeIds() {
+ selectedIds = idText.getText().split(",");
+ for (String id : selectedIds) {
+ id = id.trim();
+ }
+ }
+
}

Back to the top