| Summary: | Source code ordering during code generation/formatting [code manipulation] | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Valentin Baciu <valentinbaciu> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | Keywords: | helpwanted |
| Version: | 2.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
JDT/Core provides an API to sort compilation units using some custom Comparator. It is independant from actual formatting (we have a request to integrate this to our new formatter already). Moving to JDT/UI which is surfacing this. For 2.1 we will only provide an action to sort the members as defined in prefernences->Java->Appearance->Member Sort Order. But for 2.2 we should open this so that other plug-ins can provide their own sorting/ordering page. Postpone > 2.1 As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you. |
There is a preference that allows changing the order in which Java source code elements are displayed in views (for example in the outline view). I propose adding a preference that controls the order in which the source code is sorted (inserted) during code generation/formatting. For example, if I use QuickFix to add a missing field, I want the field be placed at the end of the class' fields list. The code generator insists on placing it at the top of the class. Similar for generating getters and setters. They are usually added at the end but I want them added together with the other getters and setters, preferably after the ones I have already but before the fields. I know this is not how Sun's source code is usually written but in our environment we prefer to have things sorted in the following order: public static fields constructors public methods protected methods private methods protected fields private fields If possible, the code that controls this could also be used during code formatting.