Bug 13538

Summary: Would like to move fields together (and to the top)
Product: [Eclipse Project] JDT Reporter: John Wiegand <John_Wiegand>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: akiezun, shanec
Version: 2.0   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description John Wiegand CLA 2002-04-11 12:10:29 EDT
(customer request)
CompilationUnits occasionally end up with field definitions spread throughout 
the file.  It is a tedious (manual) task to get all of the fields brought 
together at the top of the file.

It would be useful if there was a way to make this occur.  It could possibly be 
a formatting option, or a menu operation.  It is difficult to ask for a menu 
operation since this is not a common operation (and would add clutter).  

It is possible to add a pre-processor to the formatter for code reorganization 
before invoking the code formatting engine.
Comment 1 Adam Kiezun CLA 2002-04-11 12:32:12 EDT
John, would fixing bug 13013 help you here?
you could drag the fields and drop them over the type icon, which would drop 
them there - at the top of the type definition
Comment 2 Erich Gamma CLA 2002-05-11 08:47:03 EDT
jindent supports this sorting option. The formatter is pluggable and it would 
be possible to integrate jindent into Eclipse.

No plans to add this to the built-in formatter.
Comment 3 Dirk Baeumer CLA 2002-07-23 12:29:22 EDT
Reopening
Comment 4 Dirk Baeumer CLA 2002-07-23 12:30:20 EDT
This is more a formatting issue than a refactoring issue. Moving to JDT Core 
for commenting. They are investigating in a new formatter infrastructure.
Comment 5 Philipe Mulet CLA 2002-07-25 05:16:46 EDT
Still, reordering source may cause binary compatibility issues (innerclasses 
numbered differently). Therefore I am reluctant to consider it as a formatting 
feature.

However, I would want to have such a feature too, along with a way to sort 
members by name (fields, types then methods).

I think this can be implemented in term of the JavaModel alone... like the 
fragmented source view.
Comment 6 Philipe Mulet CLA 2002-07-25 05:20:01 EDT
Just for clarification, I too think it should be some kind of pre-processing of 
the source. Not part of the formatter, since they are occasions where I only 
want to resort, not touch the formatting.
Comment 7 Philipe Mulet CLA 2002-09-19 08:30:35 EDT
Maybe this should be part of the formatter, simply with a lightweight mode.
Comment 8 Olivier Thomann CLA 2003-01-15 13:33:39 EST
This is a subset of the request in bug 14597.

*** This bug has been marked as a duplicate of 14597 ***