Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 142947 - [DND] Classes to provide drag under feedback should be public
Summary: [DND] Classes to provide drag under feedback should be public
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Duong Nguyen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 43720 134769 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-05-22 04:58 EDT by Dirk Baeumer CLA
Modified: 2007-02-06 17:18 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2006-05-22 04:58:37 EDT
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 ?
Comment 1 Steve Northover CLA 2006-10-10 11:52:41 EDT
*** Bug 134769 has been marked as a duplicate of this bug. ***
Comment 2 Duong Nguyen CLA 2006-11-20 13:51:03 EST
*** Bug 43720 has been marked as a duplicate of this bug. ***
Comment 3 Duong Nguyen CLA 2007-01-17 16:42:06 EST
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.
Comment 4 Chris Gross CLA 2007-01-19 09:35:45 EST
w00t! thx!