1 package eu
.etaxonomy
.taxeditor
.editor
.definedterm
.handler
;
4 import org
.eclipse
.core
.commands
.AbstractHandler
;
5 import org
.eclipse
.core
.commands
.ExecutionEvent
;
6 import org
.eclipse
.core
.commands
.ExecutionException
;
7 import org
.eclipse
.core
.commands
.IHandler
;
8 import org
.eclipse
.core
.runtime
.IStatus
;
9 import org
.eclipse
.core
.runtime
.MultiStatus
;
10 import org
.eclipse
.core
.runtime
.Status
;
11 import org
.eclipse
.ui
.IWorkbenchPage
;
12 import org
.eclipse
.ui
.PartInitException
;
14 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
15 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.DefinedTermEditor
;
16 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.input
.TermEditorInput
;
17 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
18 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
22 * Copyright (C) 2009 EDIT
23 * European Distributed Institute of Taxonomy
24 * http://www.e-taxonomy.eu
26 * The contents of this file are subject to the Mozilla Public License Version 1.1
27 * See LICENSE.TXT at the top of this package for the full license terms.
35 public class OpenDefinedTermEditorHandler
extends AbstractHandler
implements IHandler
{
38 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
41 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
43 String termTypeUuid
= event
.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid");
44 IWorkbenchPage activePage
= StoreUtil
.getActivePage();
46 activePage
.openEditor(new TermEditorInput(TermType
.getByUuid(UUID
.fromString(termTypeUuid
))), DefinedTermEditor
.ID
);
47 } catch (PartInitException e
) {
49 String PID
= "eu.etaxonomy.taxeditor.application";
50 MultiStatus info
= new MultiStatus(PID
, 1, "You might be missing sufficient permissions to open the Defined Term Editor", null);
51 info
.add(new Status(IStatus
.WARNING
, PID
, 1, e
.getMessage(), null));
52 MessagingUtils
.errorDialog("Cannot open Defined Term Editor", getClass(), info
);
53 MessagingUtils
.error(getClass(), e
);