- if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof PolytomousKey){
- NavigationUtil.openEditor((PolytomousKey) structuredSelection.getFirstElement());
- }
+ Job job = new Job("Opening Polytomous Keys"){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("Opening Polytomous Keys", structuredSelection.size());
+
+ for(final Object selectedObject : structuredSelection.toArray()){
+ if(selectedObject instanceof PolytomousKey){
+
+ Display.getDefault().asyncExec(new Runnable(){
+
+ @Override
+ public void run() {
+ NavigationUtil.openEditor((PolytomousKey) selectedObject);
+ }
+
+ });
+ monitor.worked(1);
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ job.setPriority(Job.SHORT);
+ job.schedule();