1
|
/**
|
2
|
* Copyright (C) 2018 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.editor.name.operation;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.eclipse.core.commands.operations.IUndoContext;
|
14
|
|
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.TaxonEditor;
|
20
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
21
|
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
|
22
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
23
|
|
24
|
/**
|
25
|
* @author k.luther
|
26
|
* @since 02.05.2018
|
27
|
*/
|
28
|
public abstract class CreateNewTaxonBaseOperation extends AbstractPostTaxonOperation {
|
29
|
|
30
|
public CreateNewTaxonBaseOperation(String label, IUndoContext undoContext, UUID taxonUuid) {
|
31
|
super(label, undoContext, taxonUuid);
|
32
|
|
33
|
}
|
34
|
|
35
|
public CreateNewTaxonBaseOperation(String label, IUndoContext undoContext, Taxon taxon,
|
36
|
IPostOperationEnabled postOperationEnabled) {
|
37
|
super(label, undoContext, taxon, postOperationEnabled);
|
38
|
}
|
39
|
|
40
|
protected void addToSaveList(CdmBase newCdmBase) {
|
41
|
TaxonEditor editor = null;
|
42
|
Object activePart = AbstractUtility.getActivePart();
|
43
|
if (activePart instanceof TaxonEditor){
|
44
|
editor = (TaxonEditor) activePart;
|
45
|
if (newCdmBase instanceof Synonym){
|
46
|
editor.getEditorInput().addToSaveNewSynonym((Synonym)newCdmBase);
|
47
|
}else if (newCdmBase instanceof Taxon ){
|
48
|
editor.getEditorInput().addToSaveConcept((Taxon)newCdmBase);
|
49
|
}else if (newCdmBase instanceof TaxonName){
|
50
|
editor.getEditorInput().addToSaveNewName((TaxonName)newCdmBase);
|
51
|
}
|
52
|
editor.setDirty();
|
53
|
}
|
54
|
}
|
55
|
}
|