Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316473 - call to setOrientation does not change orientation in StyledText widget
Summary: call to setOrientation does not change orientation in StyledText widget
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 10:44 EDT by 4bugzilla CLA
Modified: 2011-01-25 16:28 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 4bugzilla CLA 2010-06-10 10:44:34 EDT
Build Identifier: M20100211-1343

A call to method setOrientation(SWT.RIGHT_TO_LEFT) of an instance i of StyledText does not change the TextOrientation (as it, for example, does in the Windows version). First of all, the behavior of the widget does not change. Secondly a call to getOrientation always returns SWT.LEFT_TO_RIGHT, even after a call to setOrientation(SWT.RIGHT_TO_LEFT).  

Looking at the source it's my impression that:
i) isMirrored is set once in the constructor
ii) the only other write access to isMirrored is in setOrientation
iii) in setOrientation with RIGHT_TO_LEFT the comparison
	if ((orientation & SWT.LEFT_TO_RIGHT) != 0 && !isMirrored()) {
		return;
	}
is always executed with the initial setting of isMirrored and therefore always true -> the method never reaches the line where isMirrored would be changed.
Moreover, !BidiUtil.setOrientation(...) is also always true.

Reproducible: Always

Steps to Reproduce:
1.Create an SWT based application with a StyledText instance x. Add a button or some similar control and call setOrientation(SWT.RIGHT_TO_LEFT) when button is pressed.
2.run the application and press the button. Feed the result of a call to x.getOrientation() to System.err before and after pressing the button...
3.enter some text in the StyledText to see it's still left adjusted...
Comment 1 Felipe Heidrich CLA 2010-06-15 09:19:39 EDT
setOrientation() is a hint and only works on Windows.
Comment 2 Felipe Heidrich CLA 2010-12-23 14:49:21 EST
Fixed in HEAD.