2 * Copyright (C) 2015 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
.key
.polytomous
.operation
;
11 import org
.eclipse
.core
.runtime
.IAdaptable
;
12 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
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
.editor
.l10n
.Messages
;
18 import eu
.etaxonomy
.taxeditor
.operation
.CdmDefaultOperation
;
19 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 public class CreatePolytomousKeyNodeOperation
extends CdmDefaultOperation
{
27 private final static String LABEL
= Messages
.RemotingCreatePolytomousKeyNodeOperation_CREATE_KEY
;
29 private final PolytomousKeyNode parentNode
;
30 private PolytomousKeyNode childNode
;
31 private IPostOperationEnabled postOperationEnabled
;
33 public PolytomousKeyNode
getChildNode() {
37 public CreatePolytomousKeyNodeOperation(Object source
,
39 PolytomousKeyNode parentNode
, IPostOperationEnabled postOperationEnabled
){
40 super(LABEL
, Action
.Create
, source
, async
);
41 this.parentNode
= parentNode
;
42 this.postOperationEnabled
= postOperationEnabled
;
46 protected CdmBase
doSimpleExecute(IProgressMonitor monitor
, IAdaptable info
) throws Exception
{
47 childNode
= PolytomousKeyNode
.NewInstance();
48 parentNode
.addChild(childNode
);
49 if (postOperationEnabled
.postOperation(childNode
)){