Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 15734

Summary: [PropertiesView] PropertySheet displays wrong values with multiple selection
Product: [Eclipse Project] Platform Reporter: Randy Hudson <hudsonr>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: krzysztof.daniel, n.a.edgar, snorthov, Tod_Creasey
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard: stalebug
Attachments:
Description Flags
Changed to use the LAST entry in the values array rather than the first
none
Blanking not equal property values none

Description Randy Hudson CLA 2002-05-10 10:37:48 EDT
In a tree, the last TreeItem selected has the focus, and is draw differently 
than the other TreeItems.  This is the same across all controls: the primary 
selection is the last "widget".

When the propertysheet has multiple selection, it displays the values for the 
first object in the selection.  Therefore, the displayed properties do not 
match the item that has focus.  It should be displaying values for the last 
item selected.
Comment 1 Nick Edgar CLA 2002-05-10 10:54:14 EDT
Should either show the values of the focus item, or show no value if they are 
inconsistent aross the selected items.
Checkbox presentation of boolean properties can be handled specially:
- cleared if all are false
- checked and white if all are true
- checked and gray if some but not all are true (selecting this turns them all 
to true)
Comment 2 Randy Hudson CLA 2002-05-10 11:40:27 EDT
As far as displaying that the values aren't consistent, there is nothing that 
can be done.  The CellEditor is never given multiple inputs, and it isn't 
displayed anyway unless you edit the value (unless this has changed in a recent 
build).  All you get is a String to be displayed in the TableTree.

You could play some tricks with the String, but showing no value is not 
acceptable.
Comment 3 Randy Giffen CLA 2002-05-15 09:45:55 EDT
The ordering of the items in the selection is the policy of the widget/viewer.
The tree view orders them depending on the position in the tree not the 
selection order. Thus changing the way the property sheet picks the "first" 
item will not help in this case.

We do need a better way to indicate values in the multiple selection case.
Comment 4 Randy Hudson CLA 2002-05-15 11:10:04 EDT
Can we change it to be the last item anyway?  Under the assumption that most of 
the time people multi-select from top-to-bottom, which results in the "focus" 
for native widgets being the last Item, not the first.

In GEF, we maintain the selection order, and focus stays on the item most 
recently selected, just like in the Tree.  But more importantly, our focus 
matches the last element in the ISelection.
Comment 5 Eric Moffatt CLA 2005-07-20 15:59:57 EDT
Created attachment 25082 [details]
Changed to use the LAST entry in the values array rather than the first


Note that this may change during review of the overall handling of the multiple
select cases (one thought is to not show a value unless all 'suppliers' match)
but this is at least closer that what we had.
Comment 6 Nick Edgar CLA 2005-07-28 12:33:19 EDT
It's worse than that.  Tree.getSelection() states: "The order of the items is
unspecified." and due to the way it maintains its list of items, the order can
be essentially random.  E.g. if you create A, B, C, delete B, then add D at the
end, and select all 3, getSelection() will return A, D, C.

In JFace, we could sort the selection based on the viewer's sorter, but we
probably would not want to do this all the time for performance reasons, and
that still wouldn't help for determining the focus item.

It would also help to have API to get the focus item.  Without this, we may be
able to leverage the item passed in SWT's selection event.  In the case where an
item is being added to the selection (and hence will become the focus item), I
believe that's the item the event carries.  Not sure what happens in the
ctrl+click to deselect case.

Comment 7 Nick Edgar CLA 2005-07-28 12:34:06 EDT
Given the above, I don't think there's much point in just changing it to use the
last item in the selection rather than the first.
Comment 8 Randy Hudson CLA 2005-07-28 13:49:31 EDT
Trees are not the only thing providing selection to the propertysheet. The 
behavior may be undefined for Tree but it is not for GEF. It turns out tree was 
a bad example and I should have used GEF's graphical editpart viewer instead.

The patched behavior is not worse than before, and it helps us out. Separate 
bugs should be opened for the problem with indicating dissimilar values.
Comment 9 Tod Creasey CLA 2005-08-12 13:50:16 EDT
The problem with changing this is that if anyone is relying on the current
behaviour we will break them. It may be inconsistent but I woulkd be nervous
about  introducing a significant behavioural change for this.
Comment 10 Randy Hudson CLA 2005-08-12 16:55:10 EDT
(In reply to comment #9)
> The problem with changing this is that if anyone is relying on the current
> behaviour we will break them. It may be inconsistent but I woulkd be nervous
> about  introducing a significant behavioural change for this.

In comment 6 Nick says the return order is random, so no one could be depending 
on any order assuming that native widgets are the selection source, as in Jface.
Comment 11 Krzysztof Daniel CLA 2007-01-29 09:46:36 EST
Created attachment 57701 [details]
Blanking not equal property values

Patch allows for optional blanking not equal property values.
Comment 12 Eric Moffatt CLA 2007-02-05 14:34:36 EST
Daniel, I'm assuming that all existing code will run using this patch without any changes (i.e. using the old behaviour). Do you have a test project that I can use to test this patch??
Comment 13 Randy Hudson CLA 2007-02-05 14:48:57 EST
The second patch is not related to this bug. Please open a separate bug report.
Comment 14 Eric Moffatt CLA 2007-02-06 11:53:11 EST
*** Bug 173004 has been marked as a duplicate of this bug. ***
Comment 15 Lars Vogel CLA 2019-09-06 04:26:03 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it and remove the stalebug whiteboard tag. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.