1 package eu
.etaxonomy
.taxeditor
.handler
;
3 import org
.eclipse
.core
.commands
.AbstractHandler
;
4 import org
.eclipse
.core
.commands
.ExecutionEvent
;
5 import org
.eclipse
.core
.commands
.ExecutionException
;
6 import org
.eclipse
.jface
.viewers
.ISelection
;
7 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
8 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
10 import eu
.etaxonomy
.taxeditor
.view
.CdmViewerChooser
;
13 * Opens the (first) currently selected element in a viewer. Opens a list of
14 * possible viewers if more than one are registered for this element.
20 public class OpenHandler
extends AbstractHandler
{
23 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
24 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
25 if(currentSelection
instanceof IStructuredSelection
){
26 Object firstElement
= ((IStructuredSelection
) currentSelection
).getFirstElement();
27 CdmViewerChooser viewerChooser
= new CdmViewerChooser(HandlerUtil
.getActiveShell(event
));
28 viewerChooser
.chooseViewer(firstElement
);