Project

General

Profile

Download (2.24 KB) Statistics
| Branch: | Tag: | Revision:
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.EditorUtil;
20
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
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
 */
29
public abstract class CreateNewTaxonBaseOperation extends AbstractPostTaxonOperation {
30

    
31
    /**
32
     * @param label
33
     * @param undoContext
34
     * @param taxonUuid
35
     */
36
    public CreateNewTaxonBaseOperation(String label, IUndoContext undoContext, UUID taxonUuid) {
37
        super(label, undoContext, taxonUuid);
38

    
39
    }
40

    
41
    /**
42
     * @param label
43
     * @param undoContext
44
     * @param taxon
45
     * @param postOperationEnabled
46
     */
47
    public CreateNewTaxonBaseOperation(String label, IUndoContext undoContext, Taxon taxon,
48
            IPostOperationEnabled postOperationEnabled) {
49
        super(label, undoContext, taxon, postOperationEnabled);
50
    }
51

    
52
    /**
53
     * @param newTaxonBase
54
     */
55
    protected void addToSaveList(CdmBase newCdmBase) {
56
        TaxonNameEditorE4 editor = null;
57
        Object activePart = EditorUtil.getActivePart();
58
        if (activePart instanceof TaxonNameEditorE4){
59
           editor = (TaxonNameEditorE4) activePart;
60
           if (newCdmBase instanceof Synonym){
61
               editor.getEditorInput().addToSaveNewSynonym((Synonym)newCdmBase);
62
           }else if (newCdmBase instanceof Taxon ){
63
               editor.getEditorInput().addToSaveNewConcept((Taxon)newCdmBase);
64
           }else if (newCdmBase instanceof TaxonName){
65
               editor.getEditorInput().addToSaveNewName((TaxonName)newCdmBase);
66
           }
67
           editor.setDirty();
68
        }
69
    }
70

    
71
}
(9-9/15)