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.model.description.PolytomousKey;
|
22
|
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
|
23
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
24
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
25
|
|
26
|
/**
|
27
|
* @author n.hoffmann
|
28
|
* @created Dec 2, 2010
|
29
|
* @version 1.0
|
30
|
*/
|
31
|
public class DeleteOperation extends AbstractPersistentPostOperation {
|
32
|
|
33
|
private PolytomousKey key;
|
34
|
|
35
|
/**
|
36
|
* @param label
|
37
|
* @param undoContext
|
38
|
* @param postOperationEnabled
|
39
|
*/
|
40
|
public DeleteOperation(String label, IUndoContext undoContext,
|
41
|
PolytomousKey key,
|
42
|
IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
|
43
|
super(label, undoContext, postOperationEnabled, conversationEnabled);
|
44
|
this.key = key;
|
45
|
}
|
46
|
|
47
|
/* (non-Javadoc)
|
48
|
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
49
|
*/
|
50
|
@Override
|
51
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
52
|
throws ExecutionException {
|
53
|
bind();
|
54
|
CdmStore.getService(IPolytomousKeyService.class).delete(key);
|
55
|
return postExecute(null);
|
56
|
}
|
57
|
|
58
|
/* (non-Javadoc)
|
59
|
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
60
|
*/
|
61
|
@Override
|
62
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
63
|
throws ExecutionException {
|
64
|
return null;
|
65
|
}
|
66
|
|
67
|
/* (non-Javadoc)
|
68
|
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
69
|
*/
|
70
|
@Override
|
71
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
72
|
throws ExecutionException {
|
73
|
return null;
|
74
|
}
|
75
|
|
76
|
}
|