2 * Copyright (C) 2018 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.
9 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
11 import java
.util
.UUID
;
13 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
16 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 import eu
.etaxonomy
.taxeditor
.editor
.name
.e4
.TaxonNameEditorE4
;
20 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
21 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
22 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
28 public abstract class CreateNewTaxonBaseOperation
extends AbstractPostTaxonOperation
{
30 public CreateNewTaxonBaseOperation(String label
, IUndoContext undoContext
, UUID taxonUuid
) {
31 super(label
, undoContext
, taxonUuid
);
35 public CreateNewTaxonBaseOperation(String label
, IUndoContext undoContext
, Taxon taxon
,
36 IPostOperationEnabled postOperationEnabled
) {
37 super(label
, undoContext
, taxon
, postOperationEnabled
);
40 protected void addToSaveList(CdmBase newCdmBase
) {
41 TaxonNameEditorE4 editor
= null;
42 Object activePart
= AbstractUtility
.getActivePart();
43 if (activePart
instanceof TaxonNameEditorE4
){
44 editor
= (TaxonNameEditorE4
) activePart
;
45 if (newCdmBase
instanceof Synonym
){
46 editor
.getEditorInput().addToSaveNewSynonym((Synonym
)newCdmBase
);
47 }else if (newCdmBase
instanceof Taxon
){
48 editor
.getEditorInput().addToSaveNewConcept((Taxon
)newCdmBase
);
49 }else if (newCdmBase
instanceof TaxonName
){
50 editor
.getEditorInput().addToSaveNewName((TaxonName
)newCdmBase
);