ref #6190 removing svn property place holder in first line of code - java files
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / key / polytomous / operation / RemotingCreatePolytomousKeyNodeOperation.java
1 /**
2 * Copyright (C) 2015 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.key.polytomous.operation;
10
11 import org.eclipse.core.runtime.IAdaptable;
12 import org.eclipse.core.runtime.IProgressMonitor;
13
14 import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
15 import eu.etaxonomy.cdm.model.common.CdmBase;
16 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
17 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
18 import eu.etaxonomy.taxeditor.operation.RemotingCdmDefaultOperation;
19
20 /**
21 * @author cmathew
22 * @date 21 Jul 2015
23 *
24 */
25 public class RemotingCreatePolytomousKeyNodeOperation extends RemotingCdmDefaultOperation {
26
27 private final PolytomousKeyNode parentNode;
28 private PolytomousKeyNode childNode;
29 /**
30 *
31 */
32 protected IPostOperationEnabled postOperationEnabled;
33
34 public PolytomousKeyNode getChildNode() {
35 return childNode;
36 }
37
38 private final static String LABEL = "Create new polytomous key node";
39
40 public RemotingCreatePolytomousKeyNodeOperation(Object source,
41 boolean async,
42 PolytomousKeyNode parentNode, IPostOperationEnabled postOperationEnabled){
43 super(LABEL, Action.Create, source, async);
44 this.parentNode = parentNode;
45 this.postOperationEnabled = postOperationEnabled;
46 }
47
48 /* (non-Javadoc)
49 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmSimpleOperation#doSimpleExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
50 */
51 @Override
52 protected CdmBase doSimpleExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
53 childNode = PolytomousKeyNode.NewInstance();
54 parentNode.addChild(childNode);
55 if (postOperationEnabled.postOperation(childNode)){
56 return childNode;
57 }else {
58 return null;
59 }
60 }
61
62
63
64
65
66
67 }