text_filter.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
text_filter.addModifyListener(new FilterModifyListener());
- viewer = new ListViewer(container, SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer = new ListViewer(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
viewer.setContentProvider(new PolytomousKeyContentProvider());
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
/**
* @author n.hoffmann
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
+ PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+ ISelection selection = view.getSite().getSelectionProvider().getSelection();
if(selection instanceof StructuredSelection){
final StructuredSelection structuredSelection = (StructuredSelection) selection;
- 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();
}
return null;