Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321976 - Sort button in Outline has inverse meaning
Summary: Sort button in Outline has inverse meaning
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-source-nav (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 trivial (vote)
Target Milestone: 8.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-06 08:03 EDT by Benjamin Bihler CLA
Modified: 2010-08-13 05:23 EDT (History)
1 user (show)

See Also:


Attachments
fix (2.38 KB, patch)
2010-08-13 04:46 EDT, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Bihler CLA 2010-08-06 08:03:13 EDT
If I open the outline view of a C++ file in Eclipse Helios the meaning of the sort button is inversed. If the sort button is selected, the methods are NOT sorted, if it is deselected, the methods are sorted.

The outline view of a JAVA file works as expected.
Comment 1 Markus Schorn CLA 2010-08-09 05:54:18 EDT
This works for me as expected.
Comment 2 Benjamin Bihler CLA 2010-08-09 11:19:36 EDT
(In reply to comment #1)
> This works for me as expected.

For me not. I have tried it again (and again and again...) and now I can give you more details. :-)

In the outline view of a C++ header file, inline methods are always displayed on top of all methods if the sort button is activated - independent from the alphabetical order. Therefore if the methods are in alphabetical order in a header file and some of them are inline methods, DEACTIVATING the sort button leads to alphabetical order and ACTIVATING the sort button leads to some strange order where all inline methods are on top and the other methods are below but each block is sorted in alphabetical order.

If there had been some decorator in the outline view to mark inline methods I would have understood the sort order but so it seemed very strange to me. I hope this is not "as designed" but can be changed to be more user friendly.

Thanks,
Benjamin
Comment 3 Markus Schorn CLA 2010-08-09 11:30:24 EDT
(In reply to comment #2)
> For me not. I have tried it again (and again and again...) 
> ...
Thanks for doing that.

I can reproduce the issue with the following code:
struct S {
   int b() {};
   int a();
};

'b' is shown before 'a' regardless on whether you select the sort button.
Comment 4 Markus Schorn CLA 2010-08-13 04:46:41 EDT
Created attachment 176527 [details]
fix

The sorting was intentional. However it is problematic to separate function/method definitions from declarations because as in your example the difference can just be an implementation detail (inline vs. non-inline).
Similar whether a field is a declaration or a definition is rather subtle.

I have removed the separation of declarations and definitions in the view sorter.
Comment 5 Markus Schorn CLA 2010-08-13 04:47:35 EDT
Fixed in 8.0 > 20100813.
Comment 6 CDT Genie CLA 2010-08-13 05:23:01 EDT
*** cdt cvs genie on behalf of mschorn ***
Bug 321976: Sorting of CElements.

[*] CElementSorter.java 1.24 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java?root=Tools_Project&r1=1.23&r2=1.24