Skip to main content



      Home
Home » Newcomers » Newcomers » Remove unnecessary parts from selected code(Save Actions)
icon1.gif  Remove unnecessary parts from selected code [message #1712360] Fri, 23 October 2015 05:35 Go to next message
Eclipse UserFriend
I am able to format my Java code by configuring it in Save Actions. What I get after Saving the file is that the whole code gets formatted according to my settings. What I need is, that only a part of code gets formatted according to the settings. Say, there are 10 methods in my code and I add one more to it. What I want is that only my 11th method gets formatted and the previous 10 gets untouched. Is that possible?
NOTE: The format includes, removing unnecessary casts, parenthesis, etc.
Re: Remove unnecessary parts from selected code [message #1712415 is a reply to message #1712360] Fri, 23 October 2015 16:00 Go to previous messageGo to next message
Eclipse UserFriend
On 10/23/2015 01:19 PM, Abhijeet Ashri wrote:
> I am able to format my Java code by configuring it in Save Actions. What
> I get after Saving the file is that the whole code gets formatted
> according to my settings. What I need is, that only a part of code gets
> formatted according to the settings. Say, there are 10 methods in my
> code and I add one more to it. What I want is that only my 11th method
> gets formatted and the previous 10 gets untouched. Is that possible?
> NOTE: The format includes, removing unnecessary casts, parenthesis, etc.

Look for a commented annotation, something like // @formatter:off that
you can toggle around in your source. (I might have this misspelled or
something.)
Re: Remove unnecessary parts from selected code [message #1712483 is a reply to message #1712415] Sun, 25 October 2015 17:43 Go to previous message
Eclipse UserFriend
You've mixed Clean Up and Formatting together. "Formatting" only ever adjusts white space. "Clean Up" actually changes code. Assuming you're referring to Java source files, the Save Actions preferences have the option of only formatting edited lines.

http://i.imgur.com/dAhEN5g.png
Previous Topic:No source for AS400.class
Next Topic:Classpath entry: Jar file cannot export or publish xxxxxxxxx.jar my cause ClassNotFound Exception
Goto Forum:
  


Current Time: Thu Apr 17 11:43:48 EDT 2025

Powered by FUDForum. Page generated in 0.05168 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top