269 executablesViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
269 executablesViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
270 |
270 |
271 public void selectionChanged(SelectionChangedEvent event) { |
271 public void selectionChanged(SelectionChangedEvent event) { |
272 ISelection newSelection = event.getSelection(); |
272 ISelection newSelection = event.getSelection(); |
273 if (newSelection instanceof IStructuredSelection) { |
273 if (newSelection instanceof IStructuredSelection) { |
|
274 |
|
275 // update the remove action |
|
276 removeAction.setEnabled(!newSelection.isEmpty()); |
|
277 |
274 final Object firstElement = ((IStructuredSelection) newSelection).getFirstElement(); |
278 final Object firstElement = ((IStructuredSelection) newSelection).getFirstElement(); |
275 |
279 |
276 Job setectExeJob = new Job(Messages.ExecutablesView_Select_Executable) { |
280 Job setectExeJob = new Job(Messages.ExecutablesView_Select_Executable) { |
277 |
281 |
278 @Override |
282 @Override |
279 protected IStatus run(IProgressMonitor monitor) { |
283 protected IStatus run(IProgressMonitor monitor) { |
280 if (firstElement instanceof Executable) { |
284 if (firstElement instanceof Executable) { |
281 Executable executable = (Executable)firstElement; |
285 Executable executable = (Executable)firstElement; |
282 this.setName(Messages.ExecutablesView_Finding_Sources_Job_Name + executable.getName()); |
286 this.setName(Messages.ExecutablesView_Finding_Sources_Job_Name + executable.getName()); |
283 executable.getSourceFiles(monitor); |
287 executable.getSourceFiles(monitor); |
|
288 |
|
289 UIJob selectExeUIJob = new UIJob(Messages.ExecutablesView_Select_Executable){ |
|
290 @Override |
|
291 public IStatus runInUIThread(IProgressMonitor monitor) { |
|
292 sourceFilesViewer.setInput(firstElement); |
|
293 sourceFilesViewer.packColumns(); |
|
294 return Status.OK_STATUS; |
|
295 }}; |
|
296 selectExeUIJob.schedule(); |
284 } |
297 } |
285 UIJob selectExeUIJob = new UIJob(Messages.ExecutablesView_Select_Executable){ |
298 return Status.OK_STATUS; |
286 @Override |
|
287 public IStatus runInUIThread(IProgressMonitor monitor) { |
|
288 sourceFilesViewer.setInput(firstElement); |
|
289 if (firstElement instanceof Executable) { |
|
290 sourceFilesViewer.packColumns(); |
|
291 } |
|
292 return Status.OK_STATUS; |
|
293 }}; |
|
294 selectExeUIJob.schedule(); |
|
295 return Status.OK_STATUS; |
|
296 }}; |
299 }}; |
297 setectExeJob.schedule(); |
300 setectExeJob.schedule(); |
298 } |
301 } |
299 } |
302 } |
300 }); |
303 }); |
301 |
304 |
302 executablesViewer.packColumns(); |
305 executablesViewer.packColumns(); |
358 |
361 |
359 } |
362 } |
360 |
363 |
361 private Action createRemoveAction() { |
364 private Action createRemoveAction() { |
362 Action action = new Action("Remove") { |
365 Action action = new Action("Remove") { |
|
366 |
363 public void run() { |
367 public void run() { |
364 ISelection selection = getExecutablesViewer().getSelection(); |
368 ISelection selection = getExecutablesViewer().getSelection(); |
365 if (selection instanceof IStructuredSelection) |
369 if (selection instanceof IStructuredSelection) |
366 { |
370 { |
367 Object[] selectedObjects = ((IStructuredSelection)selection).toArray(); |
371 Object[] selectedObjects = ((IStructuredSelection)selection).toArray(); |
402 } |
406 } |
403 }; |
407 }; |
404 action.setToolTipText("Remove the selected executables"); |
408 action.setToolTipText("Remove the selected executables"); |
405 action.setImageDescriptor(ExecutablesView.DESC_REMOVE); |
409 action.setImageDescriptor(ExecutablesView.DESC_REMOVE); |
406 action.setDisabledImageDescriptor(ExecutablesView.DESC_REMOVE_DISABLED); |
410 action.setDisabledImageDescriptor(ExecutablesView.DESC_REMOVE_DISABLED); |
407 action.setEnabled(true); |
411 action.setEnabled(false); |
408 return action; |
412 return action; |
409 } |
413 } |
410 |
414 |
411 private Action createConfigureColumnsAction() { |
415 private Action createConfigureColumnsAction() { |
412 ConfigureColumnsAction action = new ConfigureColumnsAction(); |
416 ConfigureColumnsAction action = new ConfigureColumnsAction(); |
458 } |
462 } |
459 |
463 |
460 private Action createRefreshAction() { |
464 private Action createRefreshAction() { |
461 Action action = new Action(Messages.ExecutablesView_Refresh) { |
465 Action action = new Action(Messages.ExecutablesView_Refresh) { |
462 public void run() { |
466 public void run() { |
463 ExecutablesManager.getExecutablesManager().scheduleRefresh(null, 0); |
467 ExecutablesManager.getExecutablesManager().refresh(null); |
464 } |
468 } |
465 }; |
469 }; |
466 action.setToolTipText(Messages.ExecutablesView_RefreshList); |
470 action.setToolTipText(Messages.ExecutablesView_RefreshList); |
467 action.setImageDescriptor(ExecutablesView.DESC_REFRESH); |
471 action.setImageDescriptor(ExecutablesView.DESC_REFRESH); |
468 action.setDisabledImageDescriptor(ExecutablesView.DESC_REFRESH_DISABLED); |
472 action.setDisabledImageDescriptor(ExecutablesView.DESC_REFRESH_DISABLED); |