2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.actions
.ui
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.action
.Action
;
14 import org
.eclipse
.jface
.action
.IAction
;
15 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
16 import org
.eclipse
.jface
.viewers
.ISelection
;
17 import org
.eclipse
.ui
.IEditorInput
;
18 import org
.eclipse
.ui
.IWorkbenchWindow
;
19 import org
.eclipse
.ui
.IWorkbenchWindowActionDelegate
;
20 import org
.eclipse
.ui
.PartInitException
;
22 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
24 import eu
.etaxonomy
.taxeditor
.UiUtil
;
25 import eu
.etaxonomy
.taxeditor
.datasource
.CdmDataSourceRepository
;
26 import eu
.etaxonomy
.taxeditor
.editor
.MultiPageTaxonEditor
;
27 import eu
.etaxonomy
.taxeditor
.editor
.name
.CdmParserController
;
28 import eu
.etaxonomy
.taxeditor
.model
.CdmSessionDataRepository
;
29 import eu
.etaxonomy
.taxeditor
.model
.NameEditorInput
;
30 import eu
.etaxonomy
.taxeditor
.navigation
.RecentNamesView
;
31 import eu
.etaxonomy
.taxeditor
.navigation
.TaxonomicTreeViewer
;
34 * Opens a taxon editor for an existing or new taxon.
40 public class OpenTaxonEditorAction
extends Action
implements IWorkbenchWindowActionDelegate
{
41 private static final Logger logger
= Logger
42 .getLogger(OpenTaxonEditorAction
.class);
44 private static String editTaxonText
= "Edit taxon";
45 private static String newTaxonText
= "Add new taxon";
46 // private ImageDescriptor image = TaxEditorPlugin.getDefault()
47 // .getImageDescriptor(ITaxEditorConstants.OPEN_TAXON_ICON);
48 private ImageDescriptor image
= null;
50 private IWorkbenchWindow window
;
53 public static final String ID
= "eu.etaxonomy.taxeditor.actions.opennameeditoraction"; //$NON-NLS-1$
55 public OpenTaxonEditorAction(Taxon taxon
) {
60 setText(editTaxonText
);
64 public OpenTaxonEditorAction() {
66 setImageDescriptor(image
);
74 UiUtil
.openTaxonEditor(taxon
);
75 } catch (PartInitException e
) {
79 // For clients who re-use the same instance of this class,
80 // taxon is re-initalized to ensure a new Taxon is opened every time
85 public void dispose() {
86 // TODO Auto-generated method stub
91 public void init(IWorkbenchWindow window
) {
96 public void run(IAction action
) {
101 public void selectionChanged(IAction action
, ISelection selection
) {
102 // TODO Auto-generated method stub