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

Bug 124202

Summary: [Field Assist] - decorated fields should not size the created control
Product: [Eclipse Project] Platform Reporter: Susan McCourt <susan>
Component: UIAssignee: Susan McCourt <susan>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Susan McCourt CLA 2006-01-17 15:37:25 EST
The philosophy of DecoratedField is that the client creates the target control and accesses it with normal SWT coding.  The decorated field manages the decorations but otherwise statys out of the way.

This philosophy is violated when DecoratedField sets the width of the field to IDialogConstants.ENTRY_WIDTH.  Sizing decisions should be made by the client of the decorated field, not the field itself.
Comment 1 Susan McCourt CLA 2006-01-17 17:42:20 EST
Space must be reserved for the decorations, however this can be achieved by using the form attachments that attach the decorations.  There is no need to also specify a width hint for the control itself.

Fixed DecoratedField >20060117 to not set the width of the control.  

Clients should use 
myDecoratedField.getLayoutControl()
to get the enclosing control for the field and can set the layout data accordingly, including specifying a width hint.  

If a client wants to set a specific width for the control itself, not including the decorations, then the client can set the bounds of the control itself, or else compute the layout control's width by adding on the reserved decoration width (DecoratedField.getReservedDecorationWidth())

This bug can be verified by changing the width of the decorated fields in the example and noting that they are completely within client control. 
Comment 2 Susan McCourt CLA 2006-02-14 14:45:43 EST
verified in 20060214-0800 on Win XP 
- in find/replace patch from bug #120237, the combos are sized properly by the client (when this bug existed, the find/replace dialog grew too big)
- the field assist example uses IDialogConstants to achieve the desired width.