if (tableItem != null) {
if (tableItem.getData() instanceof FeatureValue) {
// this can fail
FeatureValue value = (FeatureValue) tableItem.getData();
TypeSystem typeSystem = value.getFeatureStructure().getCAS().getTypeSystem();
Type range = value.getFeature().getRange();
FeatureStructure dragFeatureStructure = (FeatureStructure) event.data;
if (typeSystem.subsumes(range, dragFeatureStructure.getType())) {
FeatureStructure target = value.getFeatureStructure();
target.setFeatureValue(value.getFeature(), dragFeatureStructure);
document.update(target);
event.detail = DND.DROP_COPY;
}
} else if (tableItem.getData() instanceof ArrayValue) {
ArrayValue value = (ArrayValue) tableItem.getData();
if (value.getFeatureStructure() instanceof ArrayFS) {
ArrayFS array = (ArrayFS) value.getFeatureStructure();
array.set(value.slot(), (FeatureStructure) event.data);
document.update(array);
event.detail = DND.DROP_COPY;
}