Community
Participate
Working Groups
I have implemented my own widget and want to support DnD. However all the API to provide drag under feedback for custom widgets is internal. Can this be made API ?
*** Bug 134769 has been marked as a duplicate of this bug. ***
*** Bug 43720 has been marked as a duplicate of this bug. ***
Fixed > 20070117 Custom widgets can now implement their own effects by extending the DragSourceEffect class and the DropTargetEffect class. The source effect can be specified for a drag source by calling DragSource.setDragSourceEffect(DragSourceEffect) and the "drag under effect" can be specified for a drop target by calling DropTarget.setDropTargetEffect(DropTargetEffect). For example, the drag source image can be specified by the user as follow: StyledText text1 = new StyledText(shell, style); DragSource source = new DragSource(text1, DND.DROP_COPY); source.setDragSourceEffect(new DragSourceEffect(text1) { public void dragStart(DragSourceEvent e) { e.image = display.getSystemImage(SWT.ICON_WARNING); } }); Similarly, the drag-under-effect on the target can be specified as follow: StyledText text2 = new StyledText(shell, style); DropTarget target = new DropTarget(text2, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK); target.setDropTargetEffect(new DropTargetEffect(text2) { public void dragOver(DropTargetEvent event) { //TODO: provide your own effect when an item is dragged over the StyledText } }); Also see TableDragSourceEffect, TableDropTargetEffect, TreeDragSourceEffect, TreeDropTargetEffect and StyledTextDropTargetEffect for examples of some default effects for Table, Tree and StyledText.
w00t! thx!