*/
private void configureLeftDND() {
final StringArrayTransfer transfer =
StringArrayTransfer.getInstance();
DragSource leftDragSource;
// Provide data in Text format
Transfer[] types = new Transfer[]{
transfer,
};
if (duplicatesAllowed) {
// This controller does not modify the list's contents because
// duplicates are allowed.
leftDragSource = new DragSource(leftListController.list,
DND.DROP_COPY);
} else {
leftDragSource = new DragSource(leftListController.list,
DND.DROP_MOVE);
// Since move is allowed we need a drop target for the left list
DropTarget leftDropTarget = new DropTarget(leftListController.list,
DND.DROP_MOVE);
leftDropTarget.setTransfer(types);
leftDropTarget.addDropListener(new DropTargetAdapter() {
public void dragOver(DropTargetEvent event) {
event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
}
public void drop(DropTargetEvent event) {
if (event.data == null) {
event.detail = DND.DROP_NONE;
} else {
leftListController.add((String[]) event.data);
// Update the current selection.
currentSelection = selectedItemsList.getItems();
}
}
});
}
leftDragSource.setTransfer(types);
leftDragSource.addDragListener(new DragSourceListener() {
public void dragStart(DragSourceEvent event) {
// Only start the drag if there is something selected
event.doit = leftListController.list.getSelectionCount() > 0;
}