3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
;
12 import java
.util
.HashMap
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.eclipse
.core
.commands
.ExecutionEvent
;
17 import org
.eclipse
.ui
.PartInitException
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
21 import eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
.DerivateView
;
22 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
23 import eu
.etaxonomy
.taxeditor
.view
.ICdmViewer
;
30 public class EditorCdmViewer
implements ICdmViewer
{
32 private final Logger logger
= Logger
.getLogger(EditorCdmViewer
.class);
35 * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
38 public void show(Object input
, Class
<?
> viewerClass
, ExecutionEvent event
) {
40 if(viewerClass
.equals(MultiPageTaxonEditor
.class)){
41 if(input
instanceof TaxonBase
){
42 TaxonEditorInput editorInput
= TaxonEditorInput
.NewInstanceFromTaxonBase(((TaxonBase
<?
>) input
).getUuid());
43 EditorUtil
.open(editorInput
);
46 else if(viewerClass
.equals(DerivateView
.class)){
47 if(input
instanceof SpecimenOrObservationBase
){
50 } catch (PartInitException e
) {
51 String errorMessage
= "Could not open editor";
52 logger
.error(errorMessage
, e
);
53 MessagingUtils
.error(EditorCdmViewer
.class, errorMessage
, e
);
58 * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
61 public Map
<Class
<?
>, String
> getViewerClasses(Object input
) {
62 Map
<Class
<?
>, String
> viewerNameMap
= new HashMap
<Class
<?
>, String
>();
63 if(input
instanceof TaxonBase
){
64 viewerNameMap
.put(MultiPageTaxonEditor
.class, "Taxon Editor");