Revision 599c91e5
Added by Andreas Müller almost 2 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/CreateNodeOperation.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
public class CreateNodeOperation extends AbstractPostTaxonOperation { |
25 | 25 |
|
26 |
PolytomousKeyNode parentNode; |
|
26 |
private PolytomousKeyNode parentNode;
|
|
27 | 27 |
private PolytomousKeyNode childNode; |
28 | 28 |
|
29 | 29 |
public CreateNodeOperation(String label, |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/CreatePolytomousKeyNodeOperation.java | ||
---|---|---|
15 | 15 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
16 | 16 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
17 | 17 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
18 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
19 | 18 |
import eu.etaxonomy.taxeditor.operation.CdmDefaultOperation; |
19 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
20 | 20 |
|
21 | 21 |
/** |
22 | 22 |
* @author cmathew |
23 | 23 |
* @date 21 Jul 2015 |
24 |
* |
|
25 | 24 |
*/ |
26 | 25 |
public class CreatePolytomousKeyNodeOperation extends CdmDefaultOperation { |
27 | 26 |
|
27 |
private final static String LABEL = Messages.RemotingCreatePolytomousKeyNodeOperation_CREATE_KEY; |
|
28 |
|
|
28 | 29 |
private final PolytomousKeyNode parentNode; |
29 | 30 |
private PolytomousKeyNode childNode; |
30 |
/** |
|
31 |
* |
|
32 |
*/ |
|
33 |
protected IPostOperationEnabled postOperationEnabled; |
|
31 |
private IPostOperationEnabled postOperationEnabled; |
|
34 | 32 |
|
35 | 33 |
public PolytomousKeyNode getChildNode() { |
36 | 34 |
return childNode; |
37 | 35 |
} |
38 | 36 |
|
39 |
private final static String LABEL = Messages.RemotingCreatePolytomousKeyNodeOperation_CREATE_KEY; |
|
40 |
|
|
41 | 37 |
public CreatePolytomousKeyNodeOperation(Object source, |
42 | 38 |
boolean async, |
43 | 39 |
PolytomousKeyNode parentNode, IPostOperationEnabled postOperationEnabled){ |
... | ... | |
46 | 42 |
this.postOperationEnabled = postOperationEnabled; |
47 | 43 |
} |
48 | 44 |
|
49 |
/* (non-Javadoc) |
|
50 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmSimpleOperation#doSimpleExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
51 |
*/ |
|
52 | 45 |
@Override |
53 | 46 |
protected CdmBase doSimpleExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
54 |
childNode = PolytomousKeyNode.NewInstance(); |
|
55 |
parentNode.addChild(childNode); |
|
56 |
if (postOperationEnabled.postOperation(childNode)){ |
|
57 |
return childNode; |
|
58 |
}else {
|
|
59 |
return null; |
|
60 |
} |
|
47 |
childNode = PolytomousKeyNode.NewInstance();
|
|
48 |
parentNode.addChild(childNode);
|
|
49 |
if (postOperationEnabled.postOperation(childNode)){
|
|
50 |
return childNode;
|
|
51 |
} else {
|
|
52 |
return null;
|
|
53 |
}
|
|
61 | 54 |
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
} |
|
55 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* |
|
3 |
*/ |
|
2 |
* Copyright (C) 2016 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 |
*/ |
|
4 | 9 |
package eu.etaxonomy.taxeditor.editor.key.polytomous.operation; |
5 | 10 |
|
6 | 11 |
import org.eclipse.core.commands.ExecutionException; |
... | ... | |
24 | 29 |
|
25 | 30 |
/** |
26 | 31 |
* @author n.hoffmann |
27 |
* |
|
28 | 32 |
*/ |
29 | 33 |
public class DeleteNodeOperation extends AbstractPostOperation<PolytomousKeyNode> { |
30 | 34 |
|
31 |
private final PolytomousKeyNode parent; |
|
32 | 35 |
private final PolytomousKeyNode node; |
33 | 36 |
private final boolean deleteChildren; |
34 | 37 |
|
35 | 38 |
public DeleteNodeOperation(String label, IUndoContext undoContext, |
36 | 39 |
PolytomousKeyNode node, IPostOperationEnabled postOperationEnabled, boolean deleteChildren) { |
37 | 40 |
super(label, undoContext, node, postOperationEnabled); |
38 |
HibernateProxyHelper.deproxy(node, PolytomousKeyNode.class);
|
|
41 |
HibernateProxyHelper.deproxy(node); |
|
39 | 42 |
this.node = node; |
40 |
this.parent = node.getParent(); |
|
41 | 43 |
this.deleteChildren = deleteChildren; |
42 | 44 |
} |
43 | 45 |
|
44 |
/* |
|
45 |
* (non-Javadoc) |
|
46 |
* |
|
47 |
* @see |
|
48 |
* org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse |
|
49 |
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
50 |
*/ |
|
51 | 46 |
@Override |
52 | 47 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
53 | 48 |
throws ExecutionException { |
... | ... | |
77 | 72 |
return postExecute(null); |
78 | 73 |
} |
79 | 74 |
|
80 |
/* |
|
81 |
* (non-Javadoc) |
|
82 |
* |
|
83 |
* @see |
|
84 |
* org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse |
|
85 |
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
86 |
*/ |
|
87 | 75 |
@Override |
88 | 76 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
89 | 77 |
throws ExecutionException { |
90 | 78 |
return execute(monitor, info); |
91 | 79 |
} |
92 | 80 |
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
95 |
* |
|
96 |
* @see |
|
97 |
* org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse |
|
98 |
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
99 |
*/ |
|
100 | 81 |
@Override |
101 | 82 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
102 | 83 |
throws ExecutionException { |
103 |
// TODO Auto-generated method stub |
|
104 | 84 |
return null; |
105 | 85 |
} |
106 |
|
|
107 |
} |
|
86 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/RefreshNodeNumberingOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2016 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 |
*/ |
|
1 | 9 |
package eu.etaxonomy.taxeditor.editor.key.polytomous.operation; |
2 | 10 |
|
3 | 11 |
import org.eclipse.core.commands.ExecutionException; |
... | ... | |
13 | 21 |
/** |
14 | 22 |
* Operation responsible for refreshing node numbers of the Polytomous Key Nodes. |
15 | 23 |
* The refresh is performed on the entire Key starting from the root. |
16 |
* |
|
17 |
* @author c.mathew |
|
18 | 24 |
* |
25 |
* @author c.mathew |
|
19 | 26 |
*/ |
20 | 27 |
public class RefreshNodeNumberingOperation extends AbstractPostTaxonOperation { |
21 | 28 |
|
22 |
PolytomousKeyNode node; |
|
23 |
private PolytomousKeyNode childNode; |
|
24 |
|
|
29 |
private PolytomousKeyNode node; |
|
30 |
|
|
25 | 31 |
public RefreshNodeNumberingOperation(String label, |
26 |
IUndoContext undoContext,
|
|
27 |
PolytomousKeyNode node,
|
|
32 |
IUndoContext undoContext, |
|
33 |
PolytomousKeyNode node, |
|
28 | 34 |
IPostOperationEnabled postOperationEnabled) { |
29 | 35 |
super(label, undoContext, postOperationEnabled); |
30 | 36 |
this.node = node; |
31 | 37 |
} |
32 |
|
|
33 |
/* (non-Javadoc) |
|
34 |
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
35 |
*/ |
|
38 |
|
|
36 | 39 |
@Override |
37 | 40 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
38 | 41 |
throws ExecutionException { |
39 | 42 |
|
40 |
node.refreshNodeNumbering();
|
|
43 |
node.refreshNodeNumbering(); |
|
41 | 44 |
return postExecute(node); |
42 | 45 |
} |
43 | 46 |
|
44 |
/* (non-Javadoc) |
|
45 |
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
46 |
*/ |
|
47 | 47 |
@Override |
48 | 48 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
49 | 49 |
throws ExecutionException { |
50 |
// TODO Auto-generated method stub |
|
51 | 50 |
return null; |
52 | 51 |
} |
53 | 52 |
|
54 |
/* (non-Javadoc) |
|
55 |
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
|
56 |
*/ |
|
57 | 53 |
@Override |
58 | 54 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
59 | 55 |
throws ExecutionException { |
60 |
// TODO Auto-generated method stub |
|
61 | 56 |
return null; |
62 | 57 |
} |
63 |
|
|
64 |
} |
|
58 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java | ||
---|---|---|
72 | 72 |
return elementUuid; |
73 | 73 |
} |
74 | 74 |
|
75 |
|
|
76 | 75 |
/** |
77 | 76 |
* This method will try to call the post operation on a possibly registered |
78 | 77 |
* IPostOperationEnabled implementor. Objects that were affected by the operation |
Also available in: Unified diff
cleanup