Reputation: 126
While commenting lines of code in eclipse kepler using /* */. After save * added automatically at starting of each line. How to prevent automatic addition of the * char.
Example: Before comment
public static int factorial(int n)
{ int result = 1;
for(int i = 2; i <= n; i++)
result *= i;
return result;
}
After Comment
/*public static int factorial(int n)
{ int result = 1;
for(int i = 2; i <= n; i++)
result *= i;
return result;
}*/
After Saving Java Code in Eclipse kepler
/*
* public static int factorial(int n) { int result = 1; for(int i = 2; i <= n; i++) result *= i; return result; }
*/
And when uncomment this code
* public static int factorial(int n) { int result = 1; for(int i = 2; i <= n; i++) result *= i; return result; }
it is like that so it takes more time to remove * chars.
Kindly help me how to remove this atuto feature.
Upvotes: 1
Views: 77
Reputation: 413
You can look at this menu:
Window -> Preferences -> Java -> Save Action (Action performed on save)
If the "Format Source Code" checkbox is checked also look at this
Window -> Preferences -> Java -> Code Style -> Formatter
Here you can edit the action that the formatter performs for all the things of code
For disable block comment uncheck the "Enable block comment formatting"
Upvotes: 0
Reputation: 553
Go to your project/workspace preferences, formatter (java code style), edit the profile (you have to copy an existing one if you don’t have one yet, you cannot edit the Eclipse [built-in]), Comments and uncheck „Enable block comment formatting“. This disables all formatting for block comments when you save/format your code.
If you don't want this for all block comments, go to the Off/On Tags also in the formatter and enable the tags. You can now //@formatter:off or //@formatter:on enable them for specific sections and disable all formattings for the defined section.
Upvotes: 2