Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » eclipse - how to change package explorer sorting order (don't want lexicographic sorting)?
eclipse - how to change package explorer sorting order (don't want lexicographic sorting)? [message #991390] Tue, 18 December 2012 21:01 Go to next message
Leon Kingston is currently offline Leon KingstonFriend
Messages: 2
Registered: December 2012
Junior Member
index.php/fa/12739/0/Is there a way I can have it:

Sonication1
Sonication2
Sonication3
...

These folders are generated by a different program, so I cannot rename them to Sonication01, etc. This is causing me so much headache because my program will read log files from the main directory in this order, so the values for Sonication2 are actually the values for Sonication10 and vice versa.
  • Attachment: lexico.jpg
    (Size: 34.75KB, Downloaded 860 times)
Re: eclipse - how to change package explorer sorting order (don't want lexicographic sorting)? [message #991417 is a reply to message #991390] Wed, 19 December 2012 01:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Leon,

No, you can't change the order. I wonder though, is there actually a
relation between your program that reads log files and the package
explore's display order? It seems clear you need to fix your program
(not the explorer) to do the sorting your want.


On 18/12/2012 2:01 PM, Leon Kingston wrote:
> Is there a way I can have it:
>
> Sonication1
> Sonication2
> Sonication3
> ..
>
> These folders are generated by a different program, so I cannot rename them to Sonication01, etc. This is causing me so much headache because my program will read log files from the main directory in this order, so the values for Sonication2 are actually the values for Sonication10 and vice versa.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: eclipse - how to change package explorer sorting order (don't want lexicographic sorting)? [message #991418 is a reply to message #991417] Wed, 19 December 2012 02:09 Go to previous message
Leon Kingston is currently offline Leon KingstonFriend
Messages: 2
Registered: December 2012
Junior Member
Ed,

You're totally right. I actually didn't write the part of this program that read the logs, so I didn't want to touch the code for that, but your post helped me find a really critical bug. While I thought Eclipse was the problem, it turns out that was not the case and Eclipse just helped me see what the issue was!

First thing I noticed was that everything was in the wrong place (i.e. Sonication2's values were actually Sonication10's). Then I noticed Eclipse had the files listed in this manner, so I immediately blamed it without thinking and wanted a way to properly sort them in the package explorer, figuring this was the order it read the files. Well it was, but it didn't read them like that just because Eclipse listed them like that! With further research, I learned this was lexicographic order. In the code that reads these logs, there was a typical Java File[] array from created by listFiles(), and a loop that would go through this array to get all the filenames. Then, I found out listFiles() ALSO sorts in lexicographic order! I just had to resort the array it created that in alphabetical order and the program reads perfectly now. Smile

Cheers!

[Updated on: Wed, 19 December 2012 02:10]

Report message to a moderator

Previous Topic:Hiding the show view toolbar
Next Topic:Using a downloaded eclipse plug-in
Goto Forum:
  


Current Time: Thu Apr 25 07:24:44 GMT 2024

Powered by FUDForum. Page generated in 0.07810 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top