Finer-grained method sorting using Eclipse Ganymede: is there a good plugin?

Here are the options we have out of the box:

alt text

I would like finer sorting when it comes to methods. I would like to:

  1. Have all methods with a name that does not start with get , is or set first.
  2. Then use access methods (whose names begin with get, is or set).

Individually, the methods in [1] and [2] above can be sorted alphabetically. Besides my dividing normal methods into two parts, I like the existing sort order.

I find this order (with the latest access methods) better, since I am more likely to find non-access methods interesting when I maintain the class and I need to fix the error, etc.

Is there a plugin that I could use? If it is not there, will it be difficult to create this type of plugin yourself? (I have never created an Eclipse plugin.)

+4
source share
2 answers

I hope this is not too late for my answer.

As far as I know, there is no such plugin (I was looking at the eclipse central plugin right now).

If you want to write such a plugin, it is not too difficult to write refactoring (the Java editor is based on AST, which can be achieved through extension points), but it may need to be studied more to create a working plugin.

Some resources that may help:

  • Plugin development resources from stackoverflow: question 592391 (sorry, but cannot send two hyperlinks)
  • Open source refactoring plugin: http://code.google.com/p/tane/ (it currently contains one refactoring plus related gui elements, it might be a good example for you)
+2
source

In 2011, a training exercise was introduced in the implementation methods of the Eclipse plugin based on ideas in Robert C. Martin's book, Clean Code . I'm still trying to work if I like it or not.

There is an open bug report to improve sorting membership functions in Eclise: Sort Members does not provide tools for grouping getter / setter pairs . It was opened in 2004 and still has no plans to implement it.

+1
source

All Articles