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

Bug 386417

Summary: A tab label in Tabbed Properties View is cut-off towards right-side
Product: [Eclipse Project] Platform Reporter: Amit Joglekar <joglekar>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pwebster
Version: 4.2   
Target Milestone: 4.3 M2   
Hardware: All   
OS: All   
Whiteboard: patch
Bug Depends on:    
Bug Blocks: 385795    
Attachments:
Description Flags
Project which can be used to reproduce this defect
none
Proposed fix
none
Before fix
none
After fix none

Description Amit Joglekar CLA 2012-08-01 13:59:56 EDT
Created attachment 219450 [details]
Project which can be used to reproduce this defect

This defect reproduces in earlier versions like 3.6 as well.

Cause is that the logic for setting widestLabelIndex value in setElements() method in TabbedPropertyList class is not consistent with rest of the code; the logic does not consistently take into account the indentation and image declared for a tab.
Comment 1 Amit Joglekar CLA 2012-08-01 15:03:06 EDT
Created attachment 219451 [details]
Proposed fix

Added a private method getTabWidth(ITabItem tabItem) for tab-width calculations. This method is now invoked from setElements() and computeSize() methods.

Made the logic in ListElement.paint() method consistent with rest of the code to use 4 units of space between image and text.

This patch can be further improved by using constants for image-width and image-to-text-space e.g.

protected static final int IMAGE_WIDTH = 16;
protected static final int IMAGE_TO_TEXT_SPACE = 4;
Comment 2 Amit Joglekar CLA 2012-08-01 15:04:48 EDT
Created attachment 219452 [details]
Before fix
Comment 3 Amit Joglekar CLA 2012-08-01 15:06:23 EDT
Created attachment 219453 [details]
After fix
Comment 4 Amit Joglekar CLA 2012-08-29 17:43:14 EDT
For JUnit tests for this proposed fix, refer to attachments for Bug 385795.