Bug 206592 - [BiDi] BIDI_HCG: Wrong display of paths in Save Resources dialog
Summary: [BiDi] BIDI_HCG: Wrong display of paths in Save Resources dialog
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-17 05:43 EDT by Tomer Mahlin CLA
Modified: 2019-09-06 16:14 EDT (History)
2 users (show)

See Also:


Attachments
Patch with suggested changes (2.32 KB, patch)
2009-09-01 07:04 EDT, Semion Chichelnitsky CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomer Mahlin CLA 2007-10-17 05:43:17 EDT
Steps To Reproduce:
---------------------
This is a Bidi specific defect. Please use Bidi characters instead of capital Latin letters in the text samples below.

1. Create module with Bidi name (e.g. MY_MODULE)
2. Create nested directory with Bidi subfolders (e.g. ABC\DEF\_123\Aa)
3. Create several artifacts in this directory (e.g. MY_BO, MY_INTERFACE etc.)
4. Make sure you apply some changes to the artifacts and don't save them.
5. Select File->Exit
6. Observe how artifacts paths appear in Save Resources dialog

The expected layout is:
<artifact name> [<full artifact file path>]

Actual display:
  ELUDOM_YM] TCEJBO_YM\CBA\FED\_123\Aa\TCEJBO_YM.xsd]

Expected display:
  TCEJBO_YM [ELUDOM_YM\CBA\FED\_123\Aa\TCEJBO_YM.xsd]

Additional info: 
-----------------
 To resolve the issue TextProcessor should be used. Please see more technical details at this site:
http://wiki.eclipse.org/index.php/New_Bidi_APIs
 It seems that TextProcessor is applied in this scenario since artifact path is correctly displayed. However, the overall display of the whole expression is still incorrect. It seems that square brackets (']' and '[') are not considered as part of separators list when TextProcessor is applied. The expected call for TextProcessor should look like this:
    String myExpression = "ARTIFACT_NAME [ARTIFACT_PATH]";    
    myExpression = TextProcessor.process(myExpression, "/\:.][");


More information:
-------------------
Grant Taylor debugged the problem, and this code is the culprit:

    /* (non-Javadoc)
     * @see org.eclipse.jface.viewers.ILabelProvider
     */
    public final String getText(Object element) {
        if (element instanceof IWorkbenchPart) {
            IWorkbenchPart part = (IWorkbenchPart) element;
            String path = part.getTitleToolTip();
            if (path == null || path.trim().length() == 0) {
                return part.getTitle();
            }
            return part.getTitle() + "  [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (element instanceof Saveable) {
        	Saveable model = (Saveable) element;
            String path = model.getToolTipText();
            if (path == null || path.trim().length() == 0) {
                return model.getName();
            }
            return model.getName() + "  [" + path + "]";  //$NON-NLS-1$ //$NON-NLS-2$
        	
        }
        return null;
    }

The above is taken from the org.eclipse.ui.model.WorkbenchPartLabelProvider class.
Comment 1 Semion Chichelnitsky CLA 2009-09-01 07:04:41 EDT
Created attachment 146174 [details]
Patch with suggested changes
Comment 2 Paul Webster CLA 2009-09-01 07:58:50 EDT
This label provider code is run for all types of parts.  Editors return either the value from their input.getToolTipText() or whatever is set on the part.  Views return the value set on their part.

The only case where we know it is a file is if we're dealing with a FileEditorInput and potentially a FileStoreEditorInput ... a client defined input might not have path semantics (if it represents a model, for example).

We need to consider this with our fix.

PW
Comment 3 Oleg Besedin CLA 2009-09-23 14:50:53 EDT
(In reply to comment #2)

It seems that this might be better solved as a part of some generic BiDi enhancement. In this bug APIs give us Strings and we don't know what semantic information they represent.

Semion, Tomer, is there a subsclass of String that would carry with it extra semantic information for the TextProcessor?
Comment 4 Tomer Mahlin CLA 2009-09-24 03:31:37 EDT
 You read our minds. Indeed it is necessary to pass somehow this semantic information to the right context. The context reported in this defect is not the only one in which this is required (another context is Problems view which displays compilation errors and shows file paths).
 Unfortunately the resolution is not going to come from JDK (I believe String can't be directly extended) and JDK now is part of Oracle ... 
 So, I guess we will have to find a different solution.
 By copy to Semion, do you have any suggestions ?
Comment 5 Eclipse Webmaster CLA 2019-09-06 16:14:32 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.