Bug 129540 - BIDI: direction of code in "compare with" window is RTL
Summary: BIDI: direction of code in "compare with" window is RTL
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows All
: P3 major (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Andre Weinand CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-27 05:09 EST by amir CLA
Modified: 2006-05-07 08:35 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot describes the curroption occured in text when using the scrollbar (123.23 KB, image/jpeg)
2006-02-27 05:13 EST, amir CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description amir CLA 2006-02-27 05:09:46 EST
Description:
When launching Eclipse with RTL dir, a java file stays in LTR direction (which is good). However, when using the "Compare with" function, the source code file is shown in RTL direction. It should be also displayed in LTR direction since it contains source code.

Scenario:
1. Run Eclipse using -rtl attribute.
2. Create a Java class.
3. Verify it opens in editor in LTR dir.
4. Right click on the class name and select "Compare with -> Local history"

Result: The compare wizard is displayed the file in RTL orientation in both sides.

Note: There is another problem regarding this wizard:
If the file contains long lines thus the java source compare windows have horizontal scroolbar, the text is being curropted once one drag the scrollbar to the left and back to the right. Sometimes it should be done several times in order to see the curruption text.
An attachment is to be attached.
Comment 1 amir CLA 2006-02-27 05:13:15 EST
Created attachment 35397 [details]
Screenshot describes the curroption occured in text when using the scrollbar
Comment 2 Felipe Heidrich CLA 2006-03-03 10:28:33 EST
Okay, not sure UI is the right component.
The editor in the view is not being created with the right flags.

Amir, when the first problem is fixed you probably won't see the pixel corruption anymore. But I think you should open separated problem report to make sure the problem gets looked at.
Comment 3 Eric Moffatt CLA 2006-03-06 10:30:34 EST
I suspect that this is a compare issue...feel free to punt back if you disagree.
Comment 4 Karice McIntyre CLA 2006-03-24 09:39:29 EST
The editor needs to override WorkbenchPart.getOrientation() to return SWT.LEFT_TO_RIGHT if the editor is java code or xml - otherwise the locale's default orientation (in this case RTL) will be used.  
Comment 5 Karice McIntyre CLA 2006-03-24 11:14:13 EST
Can this be resolved for 3.2?  This bug is on the list of sev 1 defects from
IES.
Comment 6 Karice McIntyre CLA 2006-04-07 13:35:03 EDT
This is a pretty easy fix.  All you need to do is override
IWorkbenchPartOrientation#getOrientation() 
to 
return SWT.LEFT_TO_RIGHT 
for the editor part class the implements the compare editor (is it the
CompareEditor class).  Can someone please look at this bug?
Comment 7 Andre Weinand CLA 2006-04-07 13:53:00 EDT
No, I don't think this is an easy fix.
The problem is that the CompareEditor doesn't know whether its showing Java or XML.
It is a Viewer inside the editor that knows this, but this Viewer is switched dynamically.

But this viewer uses a SourceViewer which is based on a StyledText.
So what is the mechanism to control BIDI direction for a SourceViewer or a StyledText?
Comment 8 Karice McIntyre CLA 2006-04-07 14:17:26 EDT
Eek, so it is complicated.  You can create a StyledText with the SWT#LEFT_TO_RIGHT style bit.  I don't know of a way to hard code the orientation of a Viewer.  Felipe, do you have any suggestions?
Comment 9 Felipe Heidrich CLA 2006-04-07 14:33:31 EDT
I don't know anything about viewer, sorry.

In StyledText you can change the orientation on the fly using StyledText#setOrientation(int). Does that help ?
Comment 10 Andre Weinand CLA 2006-04-10 09:34:22 EDT
Imporant question for the BIDI experts:
Is it correct that the two sides of a compare editor are flipped in Right-to-Left mode?

If yes, this means that the direction of "incoming" (blue arrow pointing to the left) and "outgoing" (black arrow point to right) would have to be flipped too.
Comment 11 Andre Weinand CLA 2006-04-10 12:21:35 EDT
fixed for > 20060410
Comment 12 amir CLA 2006-04-11 08:47:12 EDT
In RTL mode indeed the two sides of a compare editor are flipped.
For the arrows, I don't really know which arrows you intend to.
Comment 13 Andre Weinand CLA 2006-04-11 09:14:12 EDT
With my fix the sides of Compare are no longer flipped.
This means that arrow icon directions don't have to change.
Comment 14 Tom Hofmann CLA 2006-04-26 11:50:24 EDT
verifying...
Comment 15 Tom Hofmann CLA 2006-04-26 11:57:10 EDT
verified that the compare viewer shows Java code always LTR.
Comment 16 amir CLA 2006-05-07 08:35:11 EDT
Works at build I20060505