1 package eu
.etaxonomy
.taxeditor
;
3 import org
.eclipse
.jface
.action
.Action
;
4 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
5 import org
.eclipse
.ui
.IWorkbenchPage
;
6 import org
.eclipse
.ui
.IWorkbenchWindow
;
7 import org
.eclipse
.ui
.PartInitException
;
9 public class OpenViewAction
extends Action
{
11 private final IWorkbenchWindow window
;
12 private int instanceNum
= 0;
13 private final String viewId
;
15 public OpenViewAction(IWorkbenchWindow window
, String label
, String viewId
) {
19 setText(label
); //Open Another Message View
20 // The id is used to refer to the action in a menu or toolbar
21 setId(ICommandIds
.CMD_OPEN
);
22 // Associate the action with a pre-defined command, to allow key bindings.
23 setActionDefinitionId(ICommandIds
.CMD_OPEN
);
24 setImageDescriptor(Activator
.getImageDescriptorOrig("/icons/sample2.gif"));
31 window
.getActivePage().showView(viewId
, Integer
.toString(instanceNum
++), IWorkbenchPage
.VIEW_ACTIVATE
);
32 } catch (PartInitException e
) {
33 MessageDialog
.openError(window
.getShell(), "Error", "Error opening view:" + e
.getMessage());