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

Bug 182122

Summary: [Dialogs] CheckedTreeSelectionDialog#createSelectionButtons(Composite) fails to align the selection buttons to the right
Product: [Eclipse Project] Platform Reporter: Lubomir Marinov <lubomir.marinov>
Component: UIAssignee: Susan McCourt <susan>
Status: VERIFIED FIXED QA Contact:
Severity: trivial    
Priority: P5 Keywords: helpwanted
Version: 3.3   
Target Milestone: 3.5 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Tries to fix the first of the two described problems
susan: iplog+
Tries to fix the second of the two described problems
susan: iplog+
snippet to test change none

Description Lubomir Marinov CLA 2007-04-12 08:54:55 EDT
Build ID: I20070323-1616

The first of the layout problems is that the selection buttons have unnecessary space on the right:
1. CheckedTreeSelectionDialog#createSelectionButtons(Composite) configures the buttonComposite it creates with a GridLayout that initially starts with 2 numColumns.
2. Later it uses Dialog#createButton(Composite,int,String,boolean) to create the buttons "Selection All" and "Deselect All" with their parent set to buttonComposite. Because the method in question retrieves the layout of the specified parent (i.e. buttonComposite) and increases its numColumns for each created Button, the GridLayout of buttonComposite ends up with numColumns set to 4 while there are only 2 Buttons.
3. So buttonComposite is left with unintended space on the right which is easily visible when buttonComposite is aligned to the right.

The second of the layout problems is that the selection buttons are aligned to the left:
1. CheckedTreeSelectionDialog#createSelectionButtons(Composite) creates a GridData with GridData.HORIZONTAL_ALIGN_END|GridData.GRAB_HORIZONTAL which I think is intended to align buttonComposite to the right like ListSelectionDialog has the buttons "Select All" and "Deselect All" to the right. However, the GridData in question is not attached to any control with setLayoutData(Object) but is remembered in the argument composite using setData(Object) and doesn't seem to be retrieved later on.
2. So buttonComposite is left aligned to the left which is in contrast to the right-aligned buttons of ListSelectionDialog.

More information:
I think CheckedTreeSelectionDialog and ListSelectionDialog should be consistent and align the selection buttons to the same side.
Comment 1 Susan McCourt CLA 2007-06-28 16:00:11 EDT
would be nice to get a patch containing described fixes
Comment 2 Lubomir Marinov CLA 2007-07-08 16:36:51 EDT
Created attachment 73276 [details]
Tries to fix the first of the two described problems

(I'm sorry for the delay. I was on my summer vacation and I didn't have access to a computer.)
Comment 3 Lubomir Marinov CLA 2007-07-08 16:38:08 EDT
Created attachment 73277 [details]
Tries to fix the second of the two described problems
Comment 4 Susan McCourt CLA 2007-07-09 14:56:41 EDT
Thanks for the patches...
I will look at this for 3.4 (probably in M2 timeframe).
Comment 5 Susan McCourt CLA 2008-04-29 13:51:53 EDT
marking RC1, did not make it for M7 due to bigger fires
Comment 6 Philipe Mulet CLA 2008-05-23 04:29:35 EDT
Please adjust the target milestone, so it does not point at a closed milestone in the past.
Comment 7 Susan McCourt CLA 2008-05-23 11:21:14 EDT
marking 3.5 so we can address this early in the cycle.  We simply ran out of time.
Comment 8 Susan McCourt CLA 2008-11-03 17:49:28 EST
Thanks for the patches, Lubomir!
I also added some changes to the spacing and margin width of the button composite layout so that the buttons would align properly with OK and Cancel, in the same way that ListSelectionDialog does this.

Fixed in HEAD >20081103.
Comment 9 Susan McCourt CLA 2008-12-09 17:04:35 EST
Created attachment 119977 [details]
snippet to test change

test snippet
Comment 10 Susan McCourt CLA 2008-12-09 17:05:17 EST
verified on WinXP, Build id: I20081209-0100
using attached test snippet