Bug 511906

Summary: [sort members] Allow sorting by declaration order
Product: [Eclipse Project] JDT Reporter: rgra Missing name <rgransberger>
Component: UIAssignee: rgra Missing name <rgransberger>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, kalyan_prasad, noopur_gupta
Version: 4.7Flags: daniel_megert: review? (noopur_gupta)
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/90893
Whiteboard:
Attachments:
Description Flags
Initial implementation of feature (todo: test cases and clean-up) none

Description rgra Missing name CLA 2017-02-08 07:43:06 EST
Created attachment 266729 [details]
Initial implementation of feature (todo: test cases and clean-up)

The sort members action should be able to honor the declaration order of methods of implemented interfaces (and superclasses) when sorting methods of a class.

This already works when generating implemented methods in the class (https://bugs.eclipse.org/bugs/show_bug.cgi?id=140971).

This makes only sense when the source for the interface is available as well and the use case is somewhat limited.

When implementing a new interface and new class it happens that I need to change the order of methods in the interface later on and want the same order in the class. Nowadays I will have to sort the interface and then the class again.

One of the open questions is where methods which are not implementations of a superclass or interface should go. Options are 
1) at the beginning
2) at the end
3) Relative to where they have been before in reference to the nearest overridden method

I currently prefer option 2 to put them last.

Another open question is where the setting should go:
On the sort members preference page or in the sort members dialog?

A first working solution is provided as a patch with the setting on the preference page.
Comment 1 Eclipse Genie CLA 2017-02-12 14:07:17 EST
New Gerrit change created: https://git.eclipse.org/r/90893