270 |
272 |
271 public void selectionChanged(SelectionChangedEvent event) { |
273 public void selectionChanged(SelectionChangedEvent event) { |
272 ISelection newSelection = event.getSelection(); |
274 ISelection newSelection = event.getSelection(); |
273 if (newSelection instanceof IStructuredSelection) { |
275 if (newSelection instanceof IStructuredSelection) { |
274 |
276 |
275 // update the remove action |
277 if (oldSelection == null || !oldSelection.equals(newSelection)) |
276 removeAction.setEnabled(!newSelection.isEmpty()); |
278 { |
|
279 // update the remove action |
|
280 removeAction.setEnabled(!newSelection.isEmpty()); |
|
281 |
|
282 final Object firstElement = ((IStructuredSelection) newSelection).getFirstElement(); |
|
283 |
|
284 Job setectExeJob = new Job(Messages.ExecutablesView_Select_Executable) { |
|
285 |
|
286 @Override |
|
287 protected IStatus run(IProgressMonitor monitor) { |
|
288 if (firstElement instanceof Executable) { |
|
289 Executable executable = (Executable)firstElement; |
|
290 this.setName(Messages.ExecutablesView_Finding_Sources_Job_Name + executable.getName()); |
|
291 executable.getSourceFiles(monitor); |
|
292 } |
|
293 // selection could be empty, so do this no matter what to update the source |
|
294 // files viewer |
|
295 UIJob selectExeUIJob = new UIJob(Messages.ExecutablesView_Select_Executable){ |
|
296 @Override |
|
297 public IStatus runInUIThread(IProgressMonitor monitor) { |
|
298 sourceFilesViewer.setInput(firstElement); |
|
299 sourceFilesViewer.packColumns(); |
|
300 return Status.OK_STATUS; |
|
301 }}; |
|
302 selectExeUIJob.schedule(); |
|
303 return Status.OK_STATUS; |
|
304 }}; |
|
305 setectExeJob.schedule(); |
|
306 oldSelection = (IStructuredSelection) newSelection; |
|
307 } |
277 |
308 |
278 final Object firstElement = ((IStructuredSelection) newSelection).getFirstElement(); |
|
279 |
|
280 Job setectExeJob = new Job(Messages.ExecutablesView_Select_Executable) { |
|
281 |
|
282 @Override |
|
283 protected IStatus run(IProgressMonitor monitor) { |
|
284 if (firstElement instanceof Executable) { |
|
285 Executable executable = (Executable)firstElement; |
|
286 this.setName(Messages.ExecutablesView_Finding_Sources_Job_Name + executable.getName()); |
|
287 executable.getSourceFiles(monitor); |
|
288 } |
|
289 // selection could be empty, so do this no matter what to update the source |
|
290 // files viewer |
|
291 UIJob selectExeUIJob = new UIJob(Messages.ExecutablesView_Select_Executable){ |
|
292 @Override |
|
293 public IStatus runInUIThread(IProgressMonitor monitor) { |
|
294 sourceFilesViewer.setInput(firstElement); |
|
295 sourceFilesViewer.packColumns(); |
|
296 return Status.OK_STATUS; |
|
297 }}; |
|
298 selectExeUIJob.schedule(); |
|
299 return Status.OK_STATUS; |
|
300 }}; |
|
301 setectExeJob.schedule(); |
|
302 } |
309 } |
303 } |
310 } |
304 }); |
311 }); |
305 |
312 |
306 executablesViewer.packColumns(); |
313 executablesViewer.packColumns(); |