Revision 1884064f
Added by Katja Luther almost 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDropAdapterE4.java | ||
---|---|---|
89 | 89 |
if (getCurrentTarget() instanceof TaxonNodeDto) { |
90 | 90 |
Set<TaxonNodeDto> taxonNodes = getSelectedTaxa(); |
91 | 91 |
TaxonNodeDto targetTreeNode = (TaxonNodeDto) target; |
92 |
// if (targetTreeNode.getType() != null && targetTreeNode.getType().equals(Classification.class)){ |
|
93 |
// targetTreeNode = ((Classification)targetTreeNode).getRootNode(); |
|
94 |
// targetTreeNode = HibernateProxyHelper.deproxy(targetTreeNode, TaxonNode.class); |
|
95 |
// } |
|
92 |
|
|
96 | 93 |
if(taxonNodes != null) { |
97 |
// if (taxonNodes.size() == 1){ |
|
98 |
boolean success = moveTaxon(taxonNodes, targetTreeNode); |
|
99 |
// if (success){ |
|
100 |
// taxonNavigator.refresh(); |
|
101 |
// } |
|
102 |
return success; |
|
103 |
// } else{ |
|
104 |
// if( MessageDialog.openConfirm(null, Messages.TreeNodeDropAdapter_MOVING, Messages.TreeNodeDropAdapter_MOVING_MESSAGE)){ |
|
105 |
// return true; |
|
106 |
// } |
|
107 |
// } |
|
94 |
boolean success = moveTaxon(taxonNodes, targetTreeNode); |
|
95 |
return success; |
|
108 | 96 |
} |
109 | 97 |
} |
110 | 98 |
return false; |
... | ... | |
201 | 189 |
} |
202 | 190 |
IUndoContext workspaceUndoContext = taxonNavigator.getUndoContext(); |
203 | 191 |
int movingTypeInt = 0; |
204 |
if (!PreferencesUtil.getSortNodesNaturally()){ |
|
205 |
// if (workspaceUndoContext == null) { |
|
206 |
// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
|
207 |
// return false; |
|
208 |
// } |
|
209 |
// result =CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(uuids,targetITaxonTreeNode.getUuid(), 0); |
|
210 |
// |
|
211 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
212 |
// return true; |
|
213 |
}else{ |
|
192 |
if (PreferencesUtil.getSortNodesNaturally()){ |
|
214 | 193 |
String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL}; |
215 | 194 |
MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0); |
216 | 195 |
dialog.open(); |
... | ... | |
222 | 201 |
return false; |
223 | 202 |
} |
224 | 203 |
|
225 |
// result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(uuids,targetITaxonTreeNode.getUuid(), 0); |
|
226 |
// |
|
227 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
228 |
// return true; |
|
229 | 204 |
}else if (returnCode == 1){ |
230 | 205 |
if (workspaceUndoContext == null) { |
231 | 206 |
logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$ |
232 | 207 |
return false; |
233 | 208 |
} |
234 |
|
|
235 | 209 |
movingTypeInt = 2; |
236 |
// CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(uuids,targetITaxonTreeNode.getUuid(), 2); |
|
237 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$ |
|
238 |
// return true; |
|
239 |
} |
|
240 |
// } else if (returnCode == 2){ |
|
241 |
// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext(); |
|
242 |
// if (workspaceUndoContext == null) { |
|
243 |
// logger.error("Workspace undo context is null. DND operation cancelled"); |
|
244 |
// return false; |
|
245 |
// } |
|
246 |
// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode; |
|
247 |
// |
|
248 |
// AbstractPostOperation operation = new MoveTaxonOperation |
|
249 |
// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND); |
|
250 |
// NavigationUtil.executeOperation(operation); |
|
251 |
// |
|
252 |
// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); |
|
253 |
// return true; |
|
254 |
// } |
|
255 |
else{ |
|
210 |
|
|
211 |
} else { |
|
256 | 212 |
return false; |
257 | 213 |
} |
258 | 214 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingMoveTaxonNodeHandlerE4.java | ||
---|---|---|
58 | 58 |
Shell shell, |
59 | 59 |
MPart activePart, |
60 | 60 |
MHandledMenuItem menuItem) { |
61 |
// check that only a single taxon tree node has been selected |
|
62 |
// if(selection.size() > 1) { |
|
63 |
// return new Status(IStatus.ERROR, |
|
64 |
// "unknown", //$NON-NLS-1$ |
|
65 |
// TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE); |
|
66 |
// } |
|
67 |
|
|
68 | 61 |
// check for no taxon tree node selected |
69 | 62 |
if(selection.size() == 0) { |
70 | 63 |
return new Status(IStatus.ERROR, |
... | ... | |
100 | 93 |
|
101 | 94 |
|
102 | 95 |
parentTaxonNode = TaxonNodeSelectionDialog.select(shell, |
103 |
// new ConversationHolderMock(), |
|
104 | 96 |
Messages.RemotingMoveTaxonNodeHandler_CHOOSE_TAXON, |
105 | 97 |
oldTaxonNodeUUIDs, |
106 | 98 |
null, |
... | ... | |
116 | 108 |
} |
117 | 109 |
} else { |
118 | 110 |
parentTaxonNode = TaxonNodeSelectionDialog.select(shell, |
119 |
// new ConversationHolderMock(), |
|
120 | 111 |
Messages.RemotingMoveTaxonNodeHandler_CHOOSE_PARENT, |
121 | 112 |
oldTaxonNodeUUIDs, |
122 | 113 |
null, |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveTaxonOperation.java | ||
---|---|---|
55 | 55 |
|
56 | 56 |
} |
57 | 57 |
|
58 |
// public RemotingMoveTaxonOperation(Object source, |
|
59 |
// boolean async, |
|
60 |
// List<TaxonNode> taxonNodeToMove, |
|
61 |
// TaxonNode newParentTreeNode, |
|
62 |
// MovingType moveToParentNode) { |
|
63 |
// super(LABEL, Action.Update, source,async); |
|
64 |
// |
|
65 |
// taxonNodesToMoveUuid=taxonNodeToMove; |
|
66 |
// this.newParentTreeNodeUuid = newParentTreeNode.getUuid(); |
|
67 |
// this.moveToParentNode = moveToParentNode; |
|
68 |
// } |
|
69 |
|
|
70 |
|
|
71 |
// /** |
|
72 |
// * @param source |
|
73 |
// * @param async |
|
74 |
// * @param uuids |
|
75 |
// * @param uuid |
|
76 |
// * @param child |
|
77 |
// */ |
|
78 |
// public RemotingMoveTaxonOperation(Object source, boolean async, Set<UUID> uuids, UUID uuid, |
|
79 |
// MovingType child) { |
|
80 |
// super(LABEL, Action.Update, source,async); |
|
81 |
// this.taxonNodesToMoveUuid = uuids; |
|
82 |
// this.newParentTreeNodeUuid = uuid; |
|
83 |
// this.moveToParentNode = child; |
|
84 |
// } |
|
85 |
|
|
86 | 58 |
/* (non-Javadoc) |
87 | 59 |
* @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
88 | 60 |
*/ |
89 | 61 |
@Override |
90 | 62 |
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
91 |
// switch (this.moveToParentNode) { |
|
92 |
// case CHILD: |
|
93 |
// return CdmApplicationState.getService(ITaxonNodeService.class).moveTaxonNodes(taxonNodesToMoveUuid, |
|
94 |
// newParentTreeNodeUuid, 0); |
|
95 |
// case BEHIND: |
|
96 |
// runMoniteredOperation(); |
|
97 |
// return updateResult; |
|
98 |
// default: |
|
99 |
// UpdateResult result = new UpdateResult(); |
|
100 |
// result.setAbort(); |
|
101 |
// result.addException(new Exception("The moving type is invalid.")); //$NON-NLS-1$ |
|
102 |
// return result; |
|
103 |
// } |
|
104 | 63 |
runMoniteredOperation(); |
105 |
// taxonNavigator.refresh(); |
|
106 | 64 |
return updateResult; |
107 | 65 |
} |
108 | 66 |
|
... | ... | |
140 | 98 |
} |
141 | 99 |
}); |
142 | 100 |
} |
143 |
// monitor.done(); |
|
101 |
|
|
144 | 102 |
|
145 | 103 |
} |
146 | 104 |
|
Also available in: Unified diff
cleanup