Bug 474656 - DND does not work in Browser widgets
Summary: DND does not work in Browser widgets
Status: NEW
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-11 02:03 EDT by Flavio Donze CLA
Modified: 2015-08-11 02:04 EDT (History)
0 users

See Also:


Attachments
modified RAP mail demo (holding a Browser in the Message View) (29.93 KB, application/x-zip-compressed)
2015-08-11 02:03 EDT, Flavio Donze CLA
no flags Details
modified RCP mail demo (holding a Browser in the Message View) (108.10 KB, application/x-zip-compressed)
2015-08-11 02:04 EDT, Flavio Donze CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Flavio Donze CLA 2015-08-11 02:03:16 EDT
Created attachment 255769 [details]
modified RAP mail demo (holding a Browser in the Message View)

It is not possible to drag elements from a TreeViewer into a Browser widget (IFrame).

This would be useful for applications which have embedded JavaScript applications running. In RCP this behavior works.

Related Forum post: https://www.eclipse.org/forums/index.php?t=rview&goto=1703589

I created an RCP and RAP example, based on the mail demo (drag from tree to text field in the message view):

NavigationView:
public void createPartControl(Composite parent) {
	viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	viewer.setContentProvider(new ViewContentProvider());
	viewer.setLabelProvider(new ViewLabelProvider());
	viewer.setInput(createDummyModel());
	
	// new dnd example code 
	int operations = DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_COPY;
	Transfer[] transfers = new Transfer[] { HTMLTransfer.getInstance(), RTFTransfer.getInstance(), TextTransfer.getInstance() };
	viewer.addDragSupport(operations, transfers, new DragSourceAdapter() {
		@Override
		public void dragSetData(DragSourceEvent event) {
			Object element = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
			if (element != null) {
				event.data = element.toString();
			}
		}
	});
}


View:
public void createPartControl(Composite parent) {
	Browser browser = new Browser(parent, SWT.NONE);
	browser.setText("<html><body><input type=\"text\" name=\"test\"></body></html>");
}
Comment 1 Flavio Donze CLA 2015-08-11 02:04:20 EDT
Created attachment 255770 [details]
modified RCP mail demo (holding a Browser in the Message View)