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?

Community
  • 1
  • 1
Yaqub Ahmad
  • 27,569
  • 23
  • 102
  • 149
  • 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 '12 at 08: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`. – ToolmakerSteve Jun 29 '15 at 21:43
  • @ToolmakerSteve FWIW I agree with you, but I know some people don't. – Carlos P Jun 30 '15 at 09:33

5 Answers5

39

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

Community
  • 1
  • 1
The Nail
  • 8,355
  • 2
  • 35
  • 48
  • 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 '12 at 02:09
  • @codingcrow in this [topic](http://stackoverflow.com/questions/6872921/code-folding-plugin-for-eclipse) 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 '12 at 12:46
  • 5
    I created an update site for the old coffee bytes code folding plugin that works with Eclipse Neon: https://github.com/stefaneidelloth/EclipseFolding/raw/master/com.cb.platsupp.site – Stefan Feb 12 '17 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.

vine
  • 846
  • 6
  • 10
  • It would be better if you actually included the details in your answer. – Mysticial Sep 23 '12 at 04:09
  • @Mysticial already updated the answer, kindly tell me the result, and will be glad to assist you further. – vine Sep 24 '12 at 07:36
  • I created an update site for the old coffee bytes code folding plugin: https://github.com/stefaneidelloth/EclipseFolding/raw/master/com.cb.platsupp.site – Stefan Aug 08 '17 at 08:45
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.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Tomas Narros
  • 13,390
  • 2
  • 40
  • 56
  • 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. – Yaqub Ahmad Dec 30 '11 at 09:29
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

sethu
  • 8,181
  • 7
  • 39
  • 65
  • 1
    Thanks for sharing, but i am afraid that it is not the alternate of #region: http://msdn.microsoft.com/en-us/library/9a1ybwek%28v=vs.71%29.aspx – Yaqub Ahmad Dec 30 '11 at 15:02
-1

Code folding from Apache Isis works fine.

user219882
  • 15,274
  • 23
  • 93
  • 138
  • Not works for me, i already have the same version coffee-Bytes: http://incubator.apache.org/isis/com.cb.eclipse.folding.KAM-3.5.zip – Yaqub Ahmad Dec 28 '11 at 02:15