| Summary: | [Tree] DND with multiselection in tree viewers is broken | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Michael Klein <michael.klein> |
| Component: | JFace | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | tbuschto |
| Version: | 1.4 | ||
| Target Milestone: | 1.4 M5 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Reproducible with Examples Demo -> Tree page too. DnD on multi Table works fine. The problem is that on mouse down for the start drag operation the multi selection is replaced with a single one. I checked against SWT/WIN. The RWT-Tree and SWT-Tree actually have the same behavior as long as the Tree is not a drag-source. If its a drag-source, the SWT-Tree changes its behavior and updates the selection on mouseup instead on mousedown (multi-seletion only). We have to do the same. Fixed in CVS HEAD. However, visuel drag-feedback is still limited to one item, this would be another issue. |
Environment: Firefox 3.6.13/IE 8.0.7600 on Win7 The bug occurs using RAP 1.4 M4. Steps to reproduce: * create a tree viewer * add drag support to the tree viewer * fill it with some items * select more than one item * try to drag the selected items -> The selection is reduced to one single item and the drag contains only one item Expected: The multiselection is untouched and the drag contains all selected items Here is a snippet to reproduce: public class Snippet implements IEntryPoint { public int createUI() { Display display = new Display(); Shell shell = new Shell(display, SWT.TITLE); createContent(shell); shell.layout(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return 0; } private void createContent(Shell shell) { shell.setLayout(new GridLayout(1, false)); Tree tree = new Tree(shell, SWT.NONE | SWT.MULTI); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TreeViewer viewer = new TreeViewer(tree); viewer.setLabelProvider(new LabelProvider()); viewer.setContentProvider(new ITreeContentProvider() { public Object[] getElements(Object inputElement) { return new Object[] {"Root"}; } public Object[] getChildren(Object parentElement) { if (hasChildren(parentElement)) { String[] input = new String[10]; for (int i = 0; i < input.length; i++) { input[i] = "Item " + i; } return input; } return new Object[0]; } public boolean hasChildren(Object element) { return element.toString().startsWith("Root"); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public Object getParent(Object element) { return null; } }); viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK, new Transfer[] {TextTransfer.getInstance()}, new DragSourceAdapter()); viewer.setInput(new Object[0]); viewer.expandAll(); } }