Eclipse\'s automatic formatter changes block comments such that the Source > Remove Block Comment does not completely remove the block comment. Source > Add Block Comment ad
I've run into this problem before and my solution is just to use line comments (//) generated by Eclipse instead of block comments. Select code, and then hit Ctrl-/ or Ctrl-7 to toggle // for every line selected. After formatting, those lines will get indented and formatted like text, but if you remove the comments (Ctrl-/ or Ctrl-7) and reformat, everything works fine.
I dont know if this helps solve your problem, but I found this very much helpful in my case. Consider this text -
String abc="abc";
String def="def";
System.out.println(abc+def);
System.exit(0);
After applying a block comment using CTRL + SHIFT + F.
/* String abc="abc";
String def="def";
System.out.println(abc+def);
*/System.exit(0);
Just add -
after /*
to exclude this block from formatting -
/*- String abc="abc";
String def="def";
System.out.println(abc+def);
*/System.exit(0);
Now Check Again!!!
This may be a little late in the game, but I fixed this by disabling block comment formatting.
Windows -> Preferences -> Java -> Code Style -> Formatter -> Edit -> Comments
Then uncheck Enable block comment formatting.
Use Ctrl + \ (Back Slash) to remove /* --- --- --- */
One other alternative solution is use of Block Selection Mode in eclipse, which is quite fast enough and still keeps your other comments formatted. You just have to press few keys to remove comments.
In windows you can toggle Block Selection Mode by ALT + SHIFT + A. Checkout the screenshot for more.
Steps to follow,