Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 406723 - [Navigator] Confusing alphabetical sort order in project explorer and resource navigator
Summary: [Navigator] Confusing alphabetical sort order in project explorer and resourc...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.3 RC1   Edit
Assignee: Francis Upton IV CLA
QA Contact: Francis Upton IV CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-27 06:24 EDT by Rakesh CLA
Modified: 2013-05-17 10:53 EDT (History)
3 users (show)

See Also:
daniel_megert: review+


Attachments
Project explorer (5.24 KB, image/png)
2013-04-27 06:24 EDT, Rakesh CLA
no flags Details
Package explorer (5.09 KB, image/png)
2013-04-27 06:25 EDT, Rakesh CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rakesh CLA 2013-04-27 06:24:55 EDT
Created attachment 230207 [details]
Project explorer

Project explorer doesn't take space into account while sorting projects. It is different in Package explorer, it takes space into account. It is a problem with large number of projects(it is confusing). Attaching screen shots which shows difference.
Comment 1 Rakesh CLA 2013-04-27 06:25:49 EDT
Created attachment 230208 [details]
Package explorer
Comment 2 Francis Upton IV CLA 2013-05-13 18:28:57 EDT
The problem is that the Collator used by the CommonNavigator is the default Java Collator which ignores white space. For the package explorer, I would imagine they have their own Collator implementation that handles all of the Java names properly.

The solution to this is probably to use a non-default Collator in the ResourceSorter (and probably change ResourceComparator as well) which pays attention to the spaces. Those classes are part of Navigator. It will take a bit of research to figure how how to make the desired Collator; any community contribution is welcome.
Comment 3 Paul Webster CLA 2013-05-13 19:52:54 EDT
(In reply to comment #2)
> The problem is that the Collator used by the CommonNavigator is the default
> Java Collator which ignores white space. For the package explorer, I would
> imagine they have their own Collator implementation that handles all of the
> Java names properly.
> 

JDT would use the com.ibm.icu.text.Collator

PW
Comment 4 Francis Upton IV CLA 2013-05-14 12:33:02 EDT
Making a change like this should be done early in a release. It means ResourceSorter can't use ViewerSorter.
Comment 5 Paul Webster CLA 2013-05-15 10:32:50 EDT
When I run the Project Explorer with no fix, I get the same sorting as the Package Explorer.  So it works for me.

What version of java are you using?  What is your LANG/Locale set to?  Mine is en_US.UTF-8

It might be your locale is set to something that ignores spaces.

PW
Comment 6 Dani Megert CLA 2013-05-15 10:43:05 EDT
(In reply to comment #5)
> When I run the Project Explorer with no fix, I get the same sorting as the
> Package Explorer.  So it works for me.
> 
> What version of java are you using?  What is your LANG/Locale set to?  Mine
> is en_US.UTF-8
> 
> It might be your locale is set to something that ignores spaces.
> 
> PW

I do see it on my Windows 7 machine with
file.encoding=Cp1252
user.country=CH
user.language=de


At this point the safest fix would be to add #compareNames(IResource, IResource) to ResourceExtensionSorter and use the ICU collator there.
Comment 7 Paul Webster CLA 2013-05-15 10:47:26 EDT
(In reply to comment #6)
> 
> 
> At this point the safest fix would be to add #compareNames(IResource,
> IResource) to ResourceExtensionSorter and use the ICU collator there.

OK, that's the  change Francis suggests: https://git.eclipse.org/r/#/c/12823/

Dani, could you review it as you can reproduce the problem?

PW
Comment 8 Francis Upton IV CLA 2013-05-15 10:56:23 EDT
I was able to reproduce the problem on my Mac, I did not try it on Linux.

(In reply to comment #5)
> When I run the Project Explorer with no fix, I get the same sorting as the
> Package Explorer.  So it works for me.
> 
> What version of java are you using?  What is your LANG/Locale set to?  Mine
> is en_US.UTF-8
> 
> It might be your locale is set to something that ignores spaces.
> 
> PW
Comment 9 Dani Megert CLA 2013-05-15 11:00:48 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > 
> > 
> > At this point the safest fix would be to add #compareNames(IResource,
> > IResource) to ResourceExtensionSorter and use the ICU collator there.
> 
> OK, that's the  change Francis suggests: https://git.eclipse.org/r/#/c/12823/
> 
> Dani, could you review it as you can reproduce the problem?
> 
> PW

Nope, that's not what he suggests. His change modifies the API class ResourceSorter. Nothing I would approve at this time.
Comment 10 Dani Megert CLA 2013-05-15 11:03:52 EDT
> Dani, could you review it as you can reproduce the problem?

My pleasure!
Comment 11 Francis Upton IV CLA 2013-05-15 11:50:13 EDT
(In reply to comment #9)

> 
> Nope, that's not what he suggests. His change modifies the API class
> ResourceSorter. Nothing I would approve at this time.
I fixed it to make the more local change.
Comment 12 Paul Webster CLA 2013-05-15 12:01:11 EDT
Latest patch set: https://git.eclipse.org/r/#/c/12834/

PW
Comment 13 Dani Megert CLA 2013-05-15 15:36:22 EDT
(In reply to comment #12)
> Latest patch set: https://git.eclipse.org/r/#/c/12834/
> 
> PW

Thanks Francis.

Change submitted with
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=af118d3e3b15987887f3b28a4e1d3acafe0b61f3
Comment 14 Paul Elder CLA 2013-05-17 10:53:38 EDT
Verified fixed. in 4.3.0.I20130516-2200, Win/7/64, IBM 1.7 JRE