I just realized that in Eclipse one cannot collapse code blocks like {}. The only thing one can collapse are methods entirely.
Now if a method does not fit on one screen anymore it is sometimes difficult to find the corresponding counterpart of a closing }.
I know the “Expand Selection To” in Eclipse but this is not optimal in cases one just wants to hide a block so the rest one is working on can only be seen.
For example in a code like this: ( EDIT: I formatted the sample code with Eclipse Format-command so it at least looks OK)
private void myMethod(String msg) {
Boolean a = true;
Integer b = 1;
Integer justSomeCode = 1;
if (a) {
switch (b) {
case 1: {
try {
justSomeCode += justSomeCode;
} catch (Exception e) {
justSomeCode += justSomeCode;
}
}
break;
case 2: {
try {
justSomeCode += justSomeCode;
} catch (Exception e) {
justSomeCode += justSomeCode;
}
}
break;
}
justSomeCode += justSomeCode;
}
else {
justSomeCode += justSomeCode;
}
}
This is what I follow
Having said that it is always preferable to have multiple methods rather than doing everything in same method.