Revision fa8083dd
Added by Andreas Müller over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java | ||
---|---|---|
90 | 90 |
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); |
91 | 91 |
if (selection instanceof TreeSelection) { |
92 | 92 |
|
93 |
Iterator selectionIterator = ((TreeSelection) selection).iterator(); |
|
93 |
Iterator<?> selectionIterator = ((TreeSelection) selection).iterator();
|
|
94 | 94 |
|
95 | 95 |
while (selectionIterator.hasNext()){ |
96 | 96 |
Object object = selectionIterator.next(); |
... | ... | |
118 | 118 |
CdmStore.currentAuthentiationHasPermission(targetNode.getTaxon(), UPDATE); |
119 | 119 |
|
120 | 120 |
if(logger.isDebugEnabled()){ |
121 |
logger.debug("target: " + targetNode.getTaxon().getTitleCache()); //$NON-NLS-1$ |
|
121 |
logger.debug("target: " + targetNode.getTaxon() == null? "-" : targetNode.getTaxon().getTitleCache()); //$NON-NLS-1$
|
|
122 | 122 |
} |
123 | 123 |
|
124 | 124 |
if(!hasTargetNodePermission || ! hasTargetNodePermission){ |
125 | 125 |
if(logger.isDebugEnabled()){ |
126 |
logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission + " " + hasTargetTaxonPermission + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
126 |
logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission + " " + hasTargetTaxonPermission + " "); //$NON-NLS-1$ |
|
127 | 127 |
} |
128 | 128 |
return Status.CANCEL_STATUS; |
129 | 129 |
} |
... | ... | |
132 | 132 |
// do not allow to drop onto itself and |
133 | 133 |
// check users permissions with all selected taxon nodes and taxa |
134 | 134 |
for(TaxonNode taxonNode : getSelectedTaxa()){ |
135 |
logger.debug("selectedTaxa: " + taxonNode.getTaxon().getTitleCache()); //$NON-NLS-1$ |
|
135 |
if (logger.isDebugEnabled()){ |
|
136 |
logger.debug("selectedTaxa: " + taxonNode.getTaxon() == null? "-" : taxonNode.getTaxon().getTitleCache()); |
|
137 |
} |
|
136 | 138 |
boolean isSameTaxonNode = taxonNode.equals(target); |
137 | 139 |
boolean hasTaxonNodePermission = CdmStore.currentAuthentiationHasPermission(taxonNode, UPDATE); |
138 | 140 |
boolean hasTaxonPermission = CdmStore.currentAuthentiationHasPermission(taxonNode.getTaxon(), UPDATE); |
... | ... | |
147 | 149 |
return Status.CANCEL_STATUS; |
148 | 150 |
} |
149 | 151 |
} |
150 |
logger.debug("OK_STATUS"); //$NON-NLS-1$
|
|
152 |
if (logger.isDebugEnabled()){logger.debug("OK_STATUS");} //$NON-NLS-1$
|
|
151 | 153 |
return Status.OK_STATUS; |
152 | 154 |
} |
153 |
logger.debug("CANCEL_STATUS"); //$NON-NLS-1$
|
|
155 |
if (logger.isDebugEnabled()){logger.debug("CANCEL_STATUS");} //$NON-NLS-1$
|
|
154 | 156 |
return Status.CANCEL_STATUS; |
155 | 157 |
} |
156 | 158 |
|
... | ... | |
168 | 170 |
if(targetITaxonTreeNode instanceof TaxonNode){ |
169 | 171 |
|
170 | 172 |
TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode; |
171 |
// Make sure parent taxon does not have unsaved changes |
|
173 |
// Make sure parent taxon does not have unsaved changes
|
|
172 | 174 |
if (NavigationUtil.isDirty(targetTaxonNode)){ |
173 | 175 |
MessageDialog.openWarning(NavigationUtil.getShell(), TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE); |
174 | 176 |
return Status.CANCEL_STATUS; |
... | ... | |
176 | 178 |
|
177 | 179 |
} |
178 | 180 |
Iterator<TaxonNode> taxIterator = taxonNodes.iterator(); |
179 |
Set<UUID> uuids = new HashSet<UUID>();
|
|
181 |
Set<UUID> uuids = new HashSet<>(); |
|
180 | 182 |
TaxonNode node = null; |
181 | 183 |
while(taxIterator.hasNext()){ |
182 | 184 |
node = taxIterator.next(); |
... | ... | |
247 | 249 |
} else{ |
248 | 250 |
return Status.CANCEL_STATUS; |
249 | 251 |
} |
250 |
|
|
251 |
|
|
252 | 252 |
} |
253 | 253 |
} |
254 | 254 |
|
Also available in: Unified diff
fix #6961 fix further potential NPEs in TreeNodeDropAdapter and TreeNodeDropAdapterAssistant and cleanup