36

I am new to java development environment and I find it difficult to manage my code properly. .Net provides the #regions which is a good solution for code management.

I am using Eclipse environment for java development. I tried the Coffee-Bytes but the Coffee-Bytes code folding is not working in Eclipse 3.6, at least on my side. I have configured it following this, but it does not work. Can someone guess what can be the issue? is there some other code folding plugin for Eclipse?

3
  • 1
    The case for code folding can be controversial; I suspect some people may have down-voted you because of their feelings on this issue, but I'm only guessing.
    – Carlos P
    Jul 23, 2012 at 8:18
  • 2
    @CarlosP: IMHO, code folding inside a method may be controversial, but being able to group several fields/methods together is an essential part of managing complex code files. The latter is the primary use (that I have seen) of C#'s #region. Jun 29, 2015 at 21:43
  • @ToolmakerSteve FWIW I agree with you, but I know some people don't.
    – Carlos P
    Jun 30, 2015 at 9:33

5 Answers 5

39
+50

For what it's worth, check my answer to this post to make it work in 3.7 (Indigo)

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

[Copy-paste with some edits:]

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 [=Sunday, December 4, 2011]:

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

3
  • Doesnt work properly in eclipse 4.2. I keep seeing a new exception in my error log every time i click in the editor window.
    – pdeva
    Jul 29, 2012 at 2:09
  • @codingcrow in this topic you mention that it works in Juno a.k.a Eclipse 4.2. Did you need to fix anything to make it work?
    – The Nail
    Jul 29, 2012 at 12:46
  • 5
    I created an update site for the old coffee bytes code folding plugin that works with Eclipse Neon: github.com/stefaneidelloth/EclipseFolding/raw/master/…
    – Stefan
    Feb 12, 2017 at 13:40
2

I found out that this Coffee bytes works in Helios. After I try to install it in my helios and disable and enable the folding. It works like a charm.

Just ask me of the details if you can't make it work.

UPDATED For Helios

Again like the other answer suggested follow this link and the steps provided

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

then in your java editor, right click on the left edge where the options that include Folding will appear, and select disable folding.Right after, select enable folding. Thats it! I am using Helios and coffee bytes is working!

Send me your feedback if still not working.

3
  • It would be better if you actually included the details in your answer.
    – Mysticial
    Sep 23, 2012 at 4:09
  • @Mysticial already updated the answer, kindly tell me the result, and will be glad to assist you further.
    – vine
    Sep 24, 2012 at 7:36
  • I created an update site for the old coffee bytes code folding plugin: github.com/stefaneidelloth/EclipseFolding/raw/master/…
    – Stefan
    Aug 8, 2017 at 8:45
1

I am not sure what #region is, but if you are looking for something that will allow you to see blocks of code and you would like to see where a particular block starts and ends easily, I would recommend the editbox plugin. You can use along with the eclipse code folding to get the best out of eclipse. The Edit box plugin is here:

http://editbox.sourceforge.net/

For making good use of the edit box, download a theme from here:

http://sourceforge.net/projects/editbox/forums/forum/1036090

1
1

Eclipse brings some out-of-the-box code folding features. You can check them at Window -> Preferences -> Java -> Editor -> Folding (Reference here). When you have the "Enable folding", you'll see a minus sign a the right border of the editor panel at the begining of every foldable block of code. Clicking on that sign will allow you to fold or expand this block of code..

Aditionally, you can, at Window -> Preferences -> Java -> Editor enable the "Only show the selected Java element" option. This way, you'll see at the editor frame only the element (as in method or class) you have selected at the navigation panel. Reference here.

1
  • 4
    Thanks for the answer. I am already using the "Eclipse Folding features", but i was looking for something like #region as mentioned in the question. Dec 30, 2011 at 9:29
-1

Code folding from Apache Isis works fine.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.