Below is a small snippet for code for implementing the drop functionality in SWT tree
int operations = DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_MOVE;
DropTarget target = new DropTarget(tree, operations);
target.setTransfer(new Transfer[] { FileTransfer.getInstance() };);
target.addDropListener(new DropTargetAdapter() {
public void drop(DropTargetEvent event) {
File f = new File (event.item)
TreeItem item = new TreeItem (root, 0);
item.setText ("item");
item.setData (f);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment