adding a taxon bulk editor and changes because the delete methods does not throw...
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / key / polytomous / operation / DeleteOperation.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.navigation.key.polytomous.operation;
12
13 import org.eclipse.core.commands.ExecutionException;
14 import org.eclipse.core.commands.operations.IUndoContext;
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.core.runtime.IStatus;
18
19 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
20 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
21 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
22 import eu.etaxonomy.cdm.model.description.PolytomousKey;
23 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
24 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
25 import eu.etaxonomy.taxeditor.store.CdmStore;
26
27 /**
28 * @author n.hoffmann
29 * @created Dec 2, 2010
30 * @version 1.0
31 */
32 public class DeleteOperation extends AbstractPersistentPostOperation {
33
34 private PolytomousKey key;
35
36 /**
37 * @param label
38 * @param undoContext
39 * @param postOperationEnabled
40 */
41 public DeleteOperation(String label, IUndoContext undoContext,
42 PolytomousKey key,
43 IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
44 super(label, undoContext, postOperationEnabled, conversationEnabled);
45 this.key = key;
46 }
47
48 /* (non-Javadoc)
49 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
50 */
51 @Override
52 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
53 throws ExecutionException {
54 bind();
55
56 String result = CdmStore.getService(IPolytomousKeyService.class).delete(key);
57
58 return postExecute(null);
59 }
60
61 /* (non-Javadoc)
62 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
63 */
64 @Override
65 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
66 throws ExecutionException {
67 return null;
68 }
69
70 /* (non-Javadoc)
71 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
72 */
73 @Override
74 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
75 throws ExecutionException {
76 return null;
77 }
78
79 }