1 package eu
.etaxonomy
.taxeditor
.editor
.definedterm
.handler
;
2 import org
.eclipse
.core
.commands
.AbstractHandler
;
3 import org
.eclipse
.core
.commands
.ExecutionEvent
;
4 import org
.eclipse
.core
.commands
.ExecutionException
;
5 import org
.eclipse
.core
.commands
.IHandler
;
6 import org
.eclipse
.core
.commands
.IParameter
;
7 import org
.eclipse
.core
.commands
.common
.NotDefinedException
;
8 import org
.eclipse
.ui
.IWorkbenchPage
;
9 import org
.eclipse
.ui
.PartInitException
;
10 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
11 import org
.eclipse
.ui
.handlers
.ShowViewHandler
;
13 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
14 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
15 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.DefinedTermEditor
;
16 import eu
.etaxonomy
.taxeditor
.editor
.definedterm
.input
.DefinedTermEditorInputFactory
;
17 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
21 * Copyright (C) 2009 EDIT
22 * European Distributed Institute of Taxonomy
23 * http://www.e-taxonomy.eu
25 * The contents of this file are subject to the Mozilla Public License Version 1.1
26 * See LICENSE.TXT at the top of this package for the full license terms.
34 public class OpenDefinedTermEditorHandler
extends AbstractHandler
implements
38 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
41 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
44 String parameter
= event
.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter");
45 Class
<?
extends DefinedTermBase
> clazz
= (Class
<?
extends DefinedTermBase
>) Class
.forName(parameter
);
47 IWorkbenchPage activePage
= StoreUtil
.getActivePage();
49 activePage
.openEditor(DefinedTermEditorInputFactory
.NewInstance(clazz
), DefinedTermEditor
.ID
);
50 } catch (PartInitException e
) {
51 StoreUtil
.error(getClass(), e
);
53 } catch (ClassNotFoundException e
) {
54 StoreUtil
.error(getClass(), e
);