Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 251474 - [Outline] Multiple selection support in the outline view
Summary: [Outline] Multiple selection support in the outline view
Status: CLOSED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xsd (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Keith Chong CLA
QA Contact: Keith Chong CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 251557
  Show dependency tree
 
Reported: 2008-10-20 16:24 EDT by Keith Chong CLA
Modified: 2009-01-06 13:08 EST (History)
3 users (show)

See Also:


Attachments
Patch (1003 bytes, patch)
2008-11-03 19:19 EST, Steven Hung CLA
valentinbaciu: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Chong CLA 2008-10-20 16:24:00 EDT
The outline view doesn't fully support actions on multiple selections.

For example delete.
Comment 1 Valentin Baciu CLA 2008-10-24 16:19:05 EDT
The WSDL editor has a similar limitation.
Comment 2 Steven Hung CLA 2008-11-03 09:40:57 EST
Having multiple selections results in some problematic cases due to the limitation in the source editor, where only one continuous block of text can be selected at once in the source editor.  When the selection change event is fired from the outline view to the source editor, this restriction can result in other items being selected.  When the source editor changes and fires the event back to the outline view, unexpected new items may have been selected or removed.

Problems:
1) User selecting items from multiple categories.  For example, if the user selects a simple type from the Types category and then uses ctrl+click to select an element from the Elements category, the source editor will select anything between the declaration of the selected simple type to the selected element.

2) Using ctrl+click within a category or group to select non-consecutive items.  For example, selecting the 1st and 4th element in a group will result in the selection of the 1st, 2nd, 3rd, and 4th element because the source editor must select a continuous block.

One potential solution is to prevent select events from firing in the outline view if more than one item is selected.  However, when delete is called, only the item selected in the source view is removed.  Thus, actions like delete don't look at the outline view to determine what items are selected.

If the source editor had the ability to select multiple (possibly disjoint) selection blocks instead of one continuous block, these problems would be eliminated.

If the user only selects items within the same category or group using shift selection, multiple selection can easily be added.  However, the unexpected behaviour associated with the valid user actions listed above makes this fix a lot trickier.
Comment 3 Steven Hung CLA 2008-11-03 11:05:23 EST
A suggested solution by Valentin was to prevent multiple selection in the outline tree viewer.  If multiple selection is disabled, at least the "snap back" behaviour will not occur.  The "snap back" behaviour is where multiple items are selected in the outline view, but becomes a single item selection shortly because of the selection change events being fired from the source view back to the outline view.  Thus, it is possible to fix this "snap back" effect in the outline view by:

1) Allowing multiple selection - tricky in the current design
2) Disabling multiple selection - a new restriction to the outline view, which is a simple change (changing the tree viewer creation from using SWT.MULTI to SWT.SINGLE)

The side-effect of disabling multiple selection is multiple items selected in the source view are no longer reflected in the outline view.  The outline view will have an empty selection.

Is this solution and side-effect appropriate?  Any ideas?
Comment 4 Steven Hung CLA 2008-11-03 19:19:27 EST
Created attachment 116889 [details]
Patch

A patch for the solution discussed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=251474#c3.

If there was a way to disable the modifiers like CTRL or SHIFT from working in the outline view and keeping the SWT.MULTI, that would at least fix the empty selection which occurs when multiple items are selected in the source view.  At the same time, it would prevent the multiple selection problems in the outline view by restricting selections to single items.
Comment 5 Valentin Baciu CLA 2008-11-07 08:45:39 EST
Keith, please give this some thought for M4.
Comment 6 Keith Chong CLA 2008-12-09 23:47:21 EST
(In reply to comment #4)
> Created an attachment (id=116889) [details]
> Patch
> A patch for the solution discussed in
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=251474#c3.
> If there was a way to disable the modifiers like CTRL or SHIFT from working in
> the outline view and keeping the SWT.MULTI, that would at least fix the empty
> selection which occurs when multiple items are selected in the source view.  At
> the same time, it would prevent the multiple selection problems in the outline
> view by restricting selections to single items.

Let's keep it single selection.  I've modified it so that if you multiple-select from the source or design, only the first component will be selected in the outline.   Released for 3.1 M4.
Comment 7 Keith Chong CLA 2008-12-16 16:36:49 EST
Verified in wtp-sdk-S-3.1M4-20081215095735. Closing bug.