Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Sort members of a compilation unit

To simplify the story, I think we can go for a more generic approach.

Something like:
org.eclipse.jdt.core.ICompilationUnit.void sort(java.util.Comparator
comparator, IProgressMonitor monitor);

The comparator would define a compare(Object, Object) method which would
expect the expected the argument to be let say a SortJavaElement.

This SortJavaElement could provide different informations:

- int modifiers
- String name
- String[] parameterTypes
- String[] parameterNames
- String returnType
- int sourceStart (to compare two initializers)
- int category (static method, static fields, type, ....)

Then it is possible to write different comparator according to the user
preferences (visibility, name, ...). By default I can provide something
similar to the actual outliner. Is this better?

We can then define where we want to put the categories (I would add them as
preferences of JavaCore). My concern with this solution is that
parameterTypes or parameterNames have no meaning for a type or a field.
Same thing for returnType. We can consider that these fields are null when
they don't make sense.

Any comment?

Olivier



Back to the top