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

Bug 346910

Summary: [debug] label "Enable OT/Equinox" is truncated when dialog font is increased
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3    
Version: 0.8   
Target Milestone: 2.0 RC2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix none

Description Stephan Herrmann CLA 2011-05-23 17:22:22 EDT
I observed this in a workbench where default fontsize was 9 and the dialog
fontsize was changed to a greater value. In this situation the mentioned
label in any OSGi-based launch configuration would be truncated like
"Enable OT/Equino".

Interestingly this truncation does not apply to the label "Enable OTRE" 
shown in non-OSGi launches, although both checkboxes/labels are 
created by the exact same code.
Comment 1 Stephan Herrmann CLA 2011-05-23 17:48:10 EDT
Created attachment 196379 [details]
fix

Confusion was caused by the fact that we are adapting base classes
from debug.ui and pde.ui, 

class LaunchConfigurationTabGroupViewer has a two phase init:
The constructor via createControl initializes the CTabFolder and already
applies the configured dialog font. Only in phase two the individual pages
are created into the fully configured parent.

In debug.ui-land it seems all intermediate children of the CTabFolder
consistently pass the parent font down the line.

In pde.ui-land class MainTab creates an intermediate Composite of which
it fails to set the font before creating individual blocks into it.
This is where our checkbox was added, so that at creation type it had
wrong font size causing a wrong widthHint to be computed.

To add insult to injury, both camps have slighlty different copies of a class
called SWTFactory. The very first difference is:

        public static int getButtonWidthHint(Button button) {
-               /*button.setFont(JFaceResources.getDialogFont());*/
+               button.setFont(JFaceResources.getDialogFont());
                PixelConverter converter= new PixelConverter(button);
                int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
                return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
        }

pde.ui uses the first line to compensate the missing font propagation,
whereas debug.ui doesn't need it. Weird, I'd say.

Long story short: the patch fixes this inconsistency by searching for the 
CTabFolder ancestor and applying its font to our "Object Teams Runtime"
group before creating the checkbox.
Comment 2 Stephan Herrmann CLA 2011-05-23 17:49:35 EDT
Patch was committed as r1623.
Comment 3 Stephan Herrmann CLA 2011-06-02 10:29:06 EDT
Verified using build 201105311237