Revision 7efcfaee
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/WorkingSetEditor.java | ||
---|---|---|
57 | 57 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
58 | 58 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
59 | 59 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
60 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
|
60 | 61 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
61 | 62 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
63 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
62 | 64 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
63 | 65 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
64 | 66 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
152 | 154 |
public void keyPressed(KeyEvent e) { |
153 | 155 |
if(e.character==SWT.DEL){ |
154 | 156 |
IStructuredSelection selection = (IStructuredSelection) composite.getTaxonNodeTree().getSelection(); |
155 |
Iterator<TaxonNode> iterator = selection.iterator(); |
|
157 |
if(selection.toList().stream().anyMatch(object->!(object instanceof TaxonNode))){ |
|
158 |
MessagingUtils.warningDialog(Messages.WorkingSetEditor_DELETE_FAIL_TITLE, this.getClass(), Messages.WorkingSetEditor_DELETE_FAIL_MESSAGE); |
|
159 |
return; |
|
160 |
} |
|
161 |
Iterator<Object> iterator = selection.iterator(); |
|
156 | 162 |
while(iterator.hasNext()){ |
157 |
TaxonNode taxonNode = iterator.next(); |
|
163 |
Object next = iterator.next(); |
|
164 |
TaxonNode taxonNode = (TaxonNode) next; |
|
158 | 165 |
removeTaxonNode(taxonNode); |
159 | 166 |
} |
160 | 167 |
} |
Also available in: Unified diff
ref #7095 Fix possible class cast exception