Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358188 - Horizontal alignment in StyledText does not work for SWT.SINGLE
Summary: Horizontal alignment in StyledText does not work for SWT.SINGLE
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: 3.7.2   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-20 03:46 EDT by Missing name CLA
Modified: 2011-12-02 14:37 EST (History)
4 users (show)

See Also:
eclipse.felipe: review+


Attachments
Snippet (925 bytes, text/x-java-source)
2011-09-21 12:09 EDT, Missing name CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2011-09-20 03:46:07 EDT
Build Identifier: 20110505-1223

Horizontal alignment (!=left) only works when StyledText style is set to SWT.MULTI and SWT.WRAP. If a StyledText SWT.SINGLE is created using the alignment SWT.CENTER or SWT.RIGHT, the text and caret disappear. It seems to be a problem related to the TextLayout width which is returning wrong numbers (like it has not width defined).

Reproducible: Always

Steps to Reproduce:
Code-snippet:
StyledText styledText = new StyledText(parent, SWT.SINGLE);
styledText.setText(text);
styledText.setAlignment(SWT.CENTER);

styledText.setBounds(rectangle);

I used this code as a Control of a CellEditor.
Comment 1 Felipe Heidrich CLA 2011-09-21 11:48:53 EDT
Does it work on Windows ?

(it does for me, I fixed this bug back in 2009, see Bug 135638)

please provide a full snippet and I will try it out. Thanks.
Comment 2 Missing name CLA 2011-09-21 12:09:35 EDT
Created attachment 203787 [details]
Snippet
Comment 3 Missing name CLA 2011-09-21 12:12:12 EDT
I've seen the previous ticket but this time it works correctly on windows. It's only a Mac issue...
Comment 4 Missing name CLA 2011-09-21 12:19:03 EDT
I've been testing the same snippet on a old swt plugin (3611d) from 2009 and it works correctly. Seems to be something exclusively related to changes made on TextLayout.
Comment 5 Felipe Heidrich CLA 2011-09-23 12:54:52 EDT
Fixed
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=1732ed48eeb8169a77bc10ecfe79588394f2ab84

Sorry, I should have paid more attention to your initial description of the problem.
Comment 6 Anders Hessellund CLA 2011-11-25 05:52:46 EST
Hi,

we are using a target platform based on Eclipse 3.7.1 for our RCP product. We are experiencing this error and we REALLY need this fix. Will this fix be included in 3.7.2? If not, WHY?

Cheers,

Anders, Deltek Inc.
Comment 7 Felipe Heidrich CLA 2011-11-29 10:23:08 EST
Silenio, Anders has requested to backported this fix to 3.7.2.
Are you okay with it ?
Comment 8 Silenio Quarti CLA 2011-11-29 10:41:14 EST
Sure. it seems safe.
Comment 9 Felipe Heidrich CLA 2011-12-02 14:37:09 EST
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R3_7_maintenance&id=68fa141ccaedf214cdcdd7723012014094057aa9

backported, please try it out when you have a chance. Thanks.