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 public void show(Object input
, Class
<?
> viewerClass
) {
36 if(viewerClass
.equals(MultiPageTaxonEditor
.class)){
37 if(input
instanceof TaxonBase
){
38 TaxonEditorInput editorInput
= TaxonEditorInput
.NewInstanceFromTaxonBase(((TaxonBase
<?
>) input
).getUuid());
39 EditorUtil
.open(editorInput
);
42 else if(viewerClass
.equals(DerivateView
.class)){
43 if(input
instanceof SpecimenOrObservationBase
){
46 } catch (PartInitException e
) {
47 String errorMessage
= "Could not open editor";
48 logger
.error(errorMessage
, e
);
49 MessagingUtils
.error(EditorCdmViewer
.class, errorMessage
, e
);
54 public Map
<Class
<?
>, String
> getViewerClasses(Object input
) {
55 Map
<Class
<?
>, String
> viewerNameMap
= new HashMap
<Class
<?
>, String
>();
56 if(input
instanceof TaxonBase
){
57 viewerNameMap
.put(MultiPageTaxonEditor
.class, "Taxon Editor");