Eclipse API and Code Folding

One of the my first open source projects I have worked on was Coffee-Bytes code folding plugin. It happened a long time ago and at some point the development has been discontinued.

However, tonight, working on some very long sources I have remembered it and I said I should give it a new try. Unfortunately, once I enabled it no editors could been displayed. Checking the .log file I have found the reason: the folding code was broken with a NoSuchMethod exception.

I have found in my archives the last version of the plugin and I thought I should check the API. To my surprise the API was still available (or at least reachable), but what made me post this entry is a feature added in Eclise 3.1: Access Restrictions, according to which when you create a plugin you can restrict others plugin access to its code. While I find the idea quite good (as it makes the API more clear), I have found out that almost everything related to java source code editors is restricted, and I am wondering why? I thought some other plugins would benefit from a clear API (for example AJDT), and now finding this makes me wonder about the reasons (I am quite sure there are good reasons).

However, getting back to the points of this entry, you can read more about Access restrictions: here.

Following the last advise specified at the above link:

But what if you really, really, really, really need to use the class? In that case, you can use it, but you need to be aware of what it means (four really’s usually does it for me).

I have done some small changes to readapt the code and now I have again Coffee-Bytes code folding working on Eclipse 3.2. Just look at the picture to see how reach it is compaired with the default code folding offered by Eclipse:

Reach Eclipse Code Folding

It offers you folding for:

  • top level types
  • normal methods
  • constructors
  • getters and setters
  • main methods
  • inner types
  • static initializers
  • import statements
  • source headers
  • comment blocks
  • javadocs

and even User defined code folding:

User defined code folding



Filed under Uncategorized

14 responses to “Eclipse API and Code Folding

  1. Anonymous

    Why don’t you donate your code folding plugin to JDT? They accept contributions as attachments to bugzilla and I think they would be receptive to your contribution.

  2. Anonymous

    I am missing this neat plugin in my eclipse as well. What about sharing your changes with the rest of the plugin users? Do you have a possibility to commit them to the plugin repository or something like that? It would be great to use it again 😉

  3. the_mindstorm

    I’ve tried to access the old SF project, but it looks like either I have forgot the info or things were changed meanwhile.
    If somebody can point me to the CVS/SVN version than I will try either to commit it, or at least publish a patch. However, if you are really eager to try it out, just contact me offline and I will send you my version.


    .w( the_mindstorm )p.

  4. Anonymous

    Hi, I’m glad I found your blog. I love the folding regions like visual studio. But I can’t use it on eclipse. I’m tring coffee-bytes as well on eclipse 3.2. Of course, it doesn’t work.

    Could you please share your version to me.
    My email is


  5. Anonymous

    Hi Alex, thank you for your offer. I would be very happy if you could send me your working version. My email is hfeldker [at] Thank you in advance.

  6. Anonymous

    Thank god, I finally find somebody could solve the coffee-byte problem on eclipse 3.2. It is one of my favorite plug-in, could you please share your version with me, my email address is, thank you! And hope you could post it on the net, which will surely be welcomed!

  7. Anonymous


    I upgraded to Eclipse 3.2 a few weeks ago. I’m missing the custom folding support of Coffee-Bytes!

    Can you please send me a copy of the folding plugin? My email address is


  8. R.J. Lorimer

    Hi Everyone – Eclipse 3.2 support is available, and we’ve moved the plug-in to Google Code for future development.
    See this blog entry for more information:

  9. Anonymous

    I just test the new version, but sames it does not work under eclipse 3.2.1
    I use eclipse3.2.1 default setting, and also install eclipseME 1.5 plug-in. When I want to use the new version of coffee-bytes from java->editing->folding, the system tell me Plug-in com.cb.eclipse.folding was unable to load class

    Could you tell me how to resolve the problem, and any one meet the same problem? THX

  10. the_mindstorm

    I am aware of this problem and it is already fixed in a SVN branch. Unfortunately, RJ hurried up to release a new version which was not as stable as I wanted.

    Allow me a couple of more days and I will put toghether a working version :-).


    .w( the_mindstorm )p.

  11. Anonymous

    com.cb.eclipse.folding was unable to load class …

    This problem should be fixed in a couple of days but as all other projects it takes more time and you will hear nothing more about it.

  12. Alex Popescu (aka the_mindstorm)

    Please read It has a link to a quite stable version (the one I am using). And indeed what you are saying: sometimes it takes more time then we expect, but mostly because we are doing this on our spare time and for fun… and we have bills to pay as you do [blink/]


    .w( the_mindstorm )p.

  13. Alex Popescu (aka the_mindstorm)

    The correct link.


    .w( the_mindstorm )p.

  14. Alex Popescu (aka the_mindstorm)

    Damn: this one is correct.


    .w( the_mindstorm )p.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s