Project

General

Profile

Download (1.93 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.featuretree.e4.operation;
10

    
11
import org.eclipse.core.commands.ExecutionException;
12
import org.eclipse.core.runtime.IAdaptable;
13
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.core.runtime.IStatus;
15

    
16
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
17
import eu.etaxonomy.cdm.model.description.Feature;
18
import eu.etaxonomy.cdm.model.description.FeatureNode;
19
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
20
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
21
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
22
import eu.etaxonomy.taxeditor.store.CdmStore;
23
import eu.etaxonomy.taxeditor.store.StoreUtil;
24

    
25
/**
26
 * @author pplitzner
27
 * @since Apr 30, 2018
28
 *
29
 */
30
public class AddFeatureOperation extends AbstractPostOperation<Feature> {
31

    
32
    private FeatureNode node;
33

    
34
    public AddFeatureOperation(Feature element, FeatureNode node,
35
            IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
36
        super("Add Feature", StoreUtil.getUndoContext(), element, postOperationEnabled, cdmEntitySessionEnabled);
37
        this.node = node;
38
    }
39

    
40
    @Override
41
    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
42
        CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(node.getUuid(), element.getUuid());
43
        return postExecute(element);
44
    }
45

    
46
    @Override
47
    public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
48
        return null;
49
    }
50

    
51
    @Override
52
    public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
53
        return null;
54
    }
55

    
56
}
(1-1/4)