Revision 803af83e
Added by Katja Luther about 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
21 | 21 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
22 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
24 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
|
23 | 25 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
24 | 26 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
25 | 27 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
... | ... | |
52 | 54 |
*/ |
53 | 55 |
@Override |
54 | 56 |
public boolean performDrop(Object data) { |
55 |
TaxonDescription target = (TaxonDescription) getCurrentTarget();
|
|
57 |
DescriptionBase target = (DescriptionBase) getCurrentTarget();
|
|
56 | 58 |
Object[] droppedElements = (Object[]) data; |
57 | 59 |
|
58 | 60 |
Collection<DescriptionElementBase> descriptionElements = new ArrayList<DescriptionElementBase>(); |
... | ... | |
78 | 80 |
description.removeElement(descriptionElement); |
79 | 81 |
target.addElement(descriptionElement); |
80 | 82 |
|
81 |
if (description.getElements().isEmpty()){ |
|
82 |
((TaxonDescription)description).getTaxon().removeDescription((TaxonDescription)description, false); |
|
83 |
if (description.getElements().isEmpty() ){ |
|
84 |
if (description instanceof TaxonDescription){ |
|
85 |
((TaxonDescription)description).getTaxon().removeDescription((TaxonDescription)description, false); |
|
86 |
}else if (description instanceof TaxonNameDescription){ |
|
87 |
((TaxonNameDescription)description).getTaxonName().removeDescription((TaxonNameDescription)description); |
|
88 |
} else if (description instanceof SpecimenDescription){ |
|
89 |
((SpecimenDescription)description).getDescribedSpecimenOrObservation().removeDescription(description); |
|
90 |
} |
|
83 | 91 |
} |
84 | 92 |
descriptionElements.add(descriptionElement); |
85 | 93 |
} |
... | ... | |
114 | 122 |
TransferData transferData) { |
115 | 123 |
boolean transferDataIsSupported = DescriptionElementTransfer.getInstance().isSupportedType( |
116 | 124 |
transferData); |
117 |
return target instanceof TaxonDescription && transferDataIsSupported;
|
|
125 |
return target instanceof DescriptionBase && transferDataIsSupported;
|
|
118 | 126 |
} |
119 | 127 |
|
120 | 128 |
} |
Also available in: Unified diff
fix #8115: fix move elements to not persisted target description