Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 299212 - [Preferences] BIDI_BDL: Incorrect path display in Linked Resources list of Preferences dialog
Summary: [Preferences] BIDI_BDL: Incorrect path display in Linked Resources list of Pr...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Oleg Besedin CLA
QA Contact: Oleg Besedin CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-10 08:35 EST by Helena Halperin CLA
Modified: 2010-03-13 12:30 EST (History)
3 users (show)

See Also:


Attachments
patch (1.86 KB, patch)
2010-01-10 09:01 EST, Helena Halperin CLA
no flags Details | Diff
updated patch (1.86 KB, patch)
2010-01-26 10:36 EST, Helena Halperin CLA
no flags Details | Diff
new patch (4.05 KB, text/plain)
2010-02-15 07:39 EST, Helena Halperin CLA
ob1.eclipse: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helena Halperin CLA 2010-01-10 08:35:07 EST
Build Identifier: I20091210-1301

Bidi bug. Lined Resources path containing Hebrew character is displayed  incorrect. 
This bug is one of the cases that are described in Bug 130587. It is excluded
to a separate bug, since bug 130587 contains different cases that needed
different fixes.

Reproducible: Always

Steps to Reproduce:
1.Run Eclipse with Hebrew locale (-nl iw), eclipse is mirrored
2. Open Preferences-> General->Workspace->Linked Resources dialog
3. Add variable with folder containing Hebrew characters, for example variable "aaa" and folder C:\XXX, where XXX are Hebrew characters  
4. Inspect display in Defined path variables list.
Expected result
C:\XXX - aaa
Actual result 
XXX\:aaa - C
Comment 1 Helena Halperin CLA 2010-01-10 09:01:57 EST
Created attachment 155676 [details]
patch

To resolve the bug, TextProcessor#process is applied on the TabelItem text, see item.setText(varName + " - " + TextProcessor.process(value.toOSString()));
If the GUI is mirrored, the variable should be on the right side of the list. For this case Unicode control character RLM is added before " - " string, see item.setText(varName + RLM + " - " + TextProcessor.process(value.toOSString()));
Attached is the patch.
Comment 2 Oleg Besedin CLA 2010-01-11 11:10:42 EST
Thanks Helena, I'll look at the patch later this week.

How does this work for other user of the PathVariablesGroup class - the PathVariableSelectionDialog?
Comment 3 Helena Halperin CLA 2010-01-13 09:48:07 EST
What is a scenario to get PathVariableSelectionDialog? I believe that path will be displayed correct, but to test it I need a scenario. Thanks
Comment 4 Oleg Besedin CLA 2010-01-25 15:18:13 EST
(In reply to comment #3)
> What is a scenario to get PathVariableSelectionDialog? I believe that path will
> be displayed correct, but to test it I need a scenario. Thanks

That is an API and so can be included by plug-in developers in their code. The Javadoc gives this example:

PathVariableSelectionDialog dialog = new PathVariableSelectionDialog(getShell(), IResource.FOLDER);
dialog.open();
String[] result = (String[]) dialog.getResult();

I don't really expect any problems there, but it is worth checking that it still works on a BiDi system.
Comment 5 Oleg Besedin CLA 2010-01-25 15:24:10 EST
By the way, the file PathVariablesGroup changed recenly - Serge made three columns with a separate column for the name. Could you update the pach?

            item.setText(0, varName);
            item.setText(1, removeParentVariable(value.toOSString()));
            item.setText(2, resolvedValue.toOSString());


probably it will become something like:

item.setText(1, TextProcessor.process(removeParentVariable(value.toOSString())));
item.setText(2, TextProcessor.process(resolvedValue.toOSString()));

Also, could you update copyright header with your information?
Comment 6 Helena Halperin CLA 2010-01-26 10:36:03 EST
Created attachment 157268 [details]
updated patch

Attached is updated patch, the code is changed according to changes in PathVariablesGroup file.
PathVariableSelectionDialog looks OK on Bidi system
Comment 7 Oleg Besedin CLA 2010-01-26 14:43:31 EST
Thanks Helena! It looks good, I'll release it as soon as we have M5 declared (this is the week with builds towards the Milestone 5 so we are releasing only critical fixes that have to be in this milestone.)
Comment 8 Oleg Besedin CLA 2010-02-11 11:33:33 EST
Opps, sorry, the file got changed again. I believe that code that puts IPaths in the screen now lives in the ValueLabelProvider subclass of the PathVariablesGroup:

class ValueLabelProvider extends CellLabelProvider
{
  public String getToolTipText(Object element) {
    ...
    IPath resolvedValue = ...;
    return resolvedValue.toOSString(); // <= add TextProcessor here?
  }
  ...
  public void update(ViewerCell cell) {
    IPath value = ...;
    cell.setText(removeParentVariable(value.toOSString())); //<= TextProcessor?
  }
}


By the way, when a user presses "Edit" button, the PathVariableDialog shows the file path as well. Does it need to have a TextProcessor warpper added?
Comment 9 Serge Beauchamp CLA 2010-02-11 13:30:59 EST
(In reply to comment #8)
> Opps, sorry, the file got changed again. I believe that code that puts IPaths
> in the screen now lives in the ValueLabelProvider subclass of the
> PathVariablesGroup:
> 
> class ValueLabelProvider extends CellLabelProvider
> {
>   public String getToolTipText(Object element) {
>     ...
>     IPath resolvedValue = ...;
>     return resolvedValue.toOSString(); // <= add TextProcessor here?
>   }
>   ...
>   public void update(ViewerCell cell) {
>     IPath value = ...;
>     cell.setText(removeParentVariable(value.toOSString())); //<= TextProcessor?
>   }
> }
> 
> 
> By the way, when a user presses "Edit" button, the PathVariableDialog shows the
> file path as well. Does it need to have a TextProcessor warpper added?

I suppose it does.  

Is there a way to convert back the locale string to a standard windows OS String?  That would be required since the user can edit the content.
Comment 10 Oleg Besedin CLA 2010-02-11 13:39:12 EST
(In reply to comment #9)
> Is there a way to convert back the locale string to a standard windows OS
> String?  That would be required since the user can edit the content.

Yes, the TextProcessor#deprocess() should do the trick.
Comment 11 Helena Halperin CLA 2010-02-15 07:39:43 EST
Created attachment 159097 [details]
new patch

(In reply to comment #8)
The file PathVariablesGroup.java is changed as proposed in comment #8
Regarding PathVariableDialog, the path appears there on 2 controls: "Location" and "Resolved location". "Resolved location" is fixed using TextProcessor#process. Unfortunately, TextProcessor#process is not solution for "Location" control, since it is editable, "dynamic" case of complex expression. There is dependency on bug [Bug 230854] [Bidi] support for text input widgets, we'll add code for "Location" when Bug 230854 will be resolved.

(In reply to comment #9 and #10)
TextProcessor#deprocess() can be used to remove contol characters from the "processed" string. But I do not see need to use it in PathVariablesGroup and PathVariableDialog. TextProcessor#process was applied on the strings used for display, the values of the items are not changed.

Attached patch contains changed for files PathVariablesGroup.java and PathVariableDialog.java
Comment 12 Oleg Besedin CLA 2010-02-16 14:34:34 EST
Thank you Helena! The "new patch" applied to CVS Head.
Comment 13 Oleg Besedin CLA 2010-03-09 10:50:10 EST
Helena, could you verify that the bug is fixed using a recent I-build (I20100309-0100 or later) and, if it is, mark this bug as verified?
Comment 14 Helena Halperin CLA 2010-03-13 12:30:15 EST
verified