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
.ui
.PartInitException
;
18 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
20 import eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
.DerivateView
;
21 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
22 import eu
.etaxonomy
.taxeditor
.view
.ICdmViewer
;
29 public class EditorCdmViewer
implements ICdmViewer
{
31 private final Logger logger
= Logger
.getLogger(EditorCdmViewer
.class);
34 * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
37 public void show(Object input
, Class
<?
> viewerClass
) {
39 if(viewerClass
.equals(MultiPageTaxonEditor
.class)){
40 if(input
instanceof TaxonBase
){
41 TaxonEditorInput editorInput
= TaxonEditorInput
.NewInstanceFromTaxonBase(((TaxonBase
<?
>) input
).getUuid());
42 EditorUtil
.open(editorInput
);
45 else if(viewerClass
.equals(DerivateView
.class)){
46 if(input
instanceof SpecimenOrObservationBase
){
49 } catch (PartInitException e
) {
50 String errorMessage
= "Could not open editor";
51 logger
.error(errorMessage
, e
);
52 MessagingUtils
.error(EditorCdmViewer
.class, errorMessage
, e
);
57 * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
60 public Map
<Class
<?
>, String
> getViewerClasses(Object input
) {
61 Map
<Class
<?
>, String
> viewerNameMap
= new HashMap
<Class
<?
>, String
>();
62 if(input
instanceof TaxonBase
){
63 viewerNameMap
.put(MultiPageTaxonEditor
.class, "Taxon Editor");