user387184
user387184

Reputation: 11053

getting an overview perspective of all methods in a class in Eclipse

I have done quite some xCode programming and found the overview perspective of the methods in a class really helpful. It looks like this:

MY_GROUP_1 <- defined with #pragma mark MY_GROUP_1
M method11
M method12
M....
MY_GROUP_2
M method21
M method22
M....

In Eclipse I only found the outline view, which does not have a grouping with a headline. So I started to define methods just to abuse them as group names like this

 /**
     * 
     * @category MessageSequence
     */
    public void __GROUP_1__() {

    }

At least I have now a list in the outline view that looks like this:

    __GROUP_1__
    method11
    method12
    method..
   __GROUP_2__
    method21
    method22
    method..

While its better than nothing, I doubt that this is the best way to get an overview of ones class structure with its methods.

What would be the right way to do this?

Many thanks!

ps also I don't know why the groupd headline methods have to be public. Eclipse does not show private methods in the overview view.

EDIT: based on the answer given by "The Nail" I update it here so that everyone can see how it works and does not have to waste time trying around...

  1. Follow the install instructions http://kosiara87.blogspot.com/2011/12/how-to-install-coffee-bytes-plugin-in.html - link found by
  2. set the identifiers in settings->java->editor->folding-> user defined regions (tab on the right) to start identifier: region, endidentifier: endregion

Now you can do:

 //region Y
    public void y1() {
    }

    public void y2() {
    }

    //endregion Y

Without the settings folding did not work for me.. Oh, yes and don't forget to restart Eclipse if it doesn't work immediately!

Upvotes: 2

Views: 5332

Answers (1)

The Nail
The Nail

Reputation: 8490

In fact, this is a duplicate of Any way to group methods in Java/Eclipse?.

The Coffee Bytes plugin is mentioned is no longer available at the referred locations. But, it seems that Bartosz Kosarzycki has posted an updated version yesterday:

http://kosiara87.blogspot.com/2011/12/how-to-install-coffee-bytes-plugin-in.html

Note that this does not provide grouping for the outline view, just (customized) folding in the editor.

Upvotes: 8

Related Questions