|
Lines 114-126
Link Here
|
| 114 |
idLabel.setText("Enter Key/&ID: "); |
114 |
idLabel.setText("Enter Key/&ID: "); |
| 115 |
idText = new Text(area, SWT.BORDER); |
115 |
idText = new Text(area, SWT.BORDER); |
| 116 |
idText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
116 |
idText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
| 117 |
idText.addModifyListener(new ModifyListener() { |
|
|
| 118 |
|
| 119 |
public void modifyText(ModifyEvent e) { |
| 120 |
validate(); |
| 121 |
} |
| 122 |
|
| 123 |
}); |
| 124 |
|
117 |
|
| 125 |
Label matchingTasksLabel = new Label(area, SWT.NONE); |
118 |
Label matchingTasksLabel = new Label(area, SWT.NONE); |
| 126 |
matchingTasksLabel.setText("&Matching tasks:"); |
119 |
matchingTasksLabel.setText("&Matching tasks:"); |
|
Lines 133-144
Link Here
|
| 133 |
|
126 |
|
| 134 |
@Override |
127 |
@Override |
| 135 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
128 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
|
|
129 |
if (selectedIds == null) { |
| 130 |
return false; |
| 131 |
} |
| 132 |
|
| 136 |
// Only shows exact task matches |
133 |
// Only shows exact task matches |
| 137 |
if (!(element instanceof AbstractRepositoryTask)) { |
134 |
if (!(element instanceof AbstractRepositoryTask)) { |
| 138 |
return false; |
135 |
return false; |
| 139 |
} |
136 |
} |
| 140 |
AbstractRepositoryTask task = (AbstractRepositoryTask) element; |
137 |
AbstractRepositoryTask task = (AbstractRepositoryTask) element; |
| 141 |
return idText.getText().trim().equals(task.getIdLabel()); |
138 |
String taskId = task.getIdLabel(); |
|
|
139 |
for (String id : selectedIds) { |
| 140 |
if (id.equals(taskId)) { |
| 141 |
return true; |
| 142 |
} |
| 143 |
} |
| 144 |
return false; |
| 142 |
} |
145 |
} |
| 143 |
|
146 |
|
| 144 |
}); |
147 |
}); |
|
Lines 146-151
Link Here
|
| 146 |
idText.addModifyListener(new ModifyListener() { |
149 |
idText.addModifyListener(new ModifyListener() { |
| 147 |
|
150 |
|
| 148 |
public void modifyText(ModifyEvent e) { |
151 |
public void modifyText(ModifyEvent e) { |
|
|
152 |
computeIds(); |
| 153 |
validate(); |
| 149 |
tasksViewer.refresh(false); |
154 |
tasksViewer.refresh(false); |
| 150 |
} |
155 |
} |
| 151 |
|
156 |
|
|
Lines 331-337
Link Here
|
| 331 |
updateStatus(new Status(IStatus.OK, TasksUiPlugin.PLUGIN_ID, 0, "", null)); |
336 |
updateStatus(new Status(IStatus.OK, TasksUiPlugin.PLUGIN_ID, 0, "", null)); |
| 332 |
} |
337 |
} |
| 333 |
|
338 |
|
| 334 |
private String selectedId; |
339 |
private String[] selectedIds; |
| 335 |
|
340 |
|
| 336 |
private TaskRepository selectedRepository; |
341 |
private TaskRepository selectedRepository; |
| 337 |
|
342 |
|
|
Lines 341-348
Link Here
|
| 341 |
|
346 |
|
| 342 |
private AbstractTaskContainer selectedCategory; |
347 |
private AbstractTaskContainer selectedCategory; |
| 343 |
|
348 |
|
| 344 |
public String getSelectedId() { |
349 |
public String[] getSelectedIds() { |
| 345 |
return selectedId; |
350 |
return selectedIds; |
| 346 |
} |
351 |
} |
| 347 |
|
352 |
|
| 348 |
public TaskRepository getSelectedTaskRepository() { |
353 |
public TaskRepository getSelectedTaskRepository() { |
|
Lines 363-369
Link Here
|
| 363 |
|
368 |
|
| 364 |
@Override |
369 |
@Override |
| 365 |
protected void computeResult() { |
370 |
protected void computeResult() { |
| 366 |
selectedId = idText.getText().trim(); |
371 |
computeIds(); |
|
|
372 |
|
| 367 |
ISelection taskSelection = tasksViewer.getSelection(); |
373 |
ISelection taskSelection = tasksViewer.getSelection(); |
| 368 |
if (!taskSelection.isEmpty()) { |
374 |
if (!taskSelection.isEmpty()) { |
| 369 |
selectedTask = (AbstractRepositoryTask) ((IStructuredSelection) taskSelection).getFirstElement(); |
375 |
selectedTask = (AbstractRepositoryTask) ((IStructuredSelection) taskSelection).getFirstElement(); |
|
Lines 378-381
Link Here
|
| 378 |
} |
384 |
} |
| 379 |
} |
385 |
} |
| 380 |
|
386 |
|
|
|
387 |
private void computeIds() { |
| 388 |
selectedIds = idText.getText().split(","); |
| 389 |
for (String id : selectedIds) { |
| 390 |
id = id.trim(); |
| 391 |
} |
| 392 |
} |
| 393 |
|
| 381 |
} |
394 |
} |