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

I like this generic approach too. It might be a little hard to figure that
one is sorting inner members... may need some enter/exit type callback on
the comparator.

Olivier Thomann/Ottawa/IBM@IBMCA@xxxxxxxxxxx on 01/16/2003 07:39:18 PM

Please respond to jdt-core-dev@xxxxxxxxxxx

Sent by:    jdt-core-dev-admin@xxxxxxxxxxx


To:    jdt-core-dev@xxxxxxxxxxx
cc:
Subject:    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

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev







Back to the top