Bug 511906 - [sort members] Allow sorting by declaration order
Summary: [sort members] Allow sorting by declaration order
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: PC Windows 10
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: rgra Missing name CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-08 07:43 EST by rgra Missing name CLA
Modified: 2019-02-07 03:18 EST (History)
3 users (show)

See Also:
daniel_megert: review? (noopur_gupta)


Attachments
Initial implementation of feature (todo: test cases and clean-up) (25.80 KB, application/octet-stream)
2017-02-08 07:43 EST, rgra Missing name CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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