Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:35 Go to next message
Abhijeet Ashri is currently offline Abhijeet AshriFriend
Messages: 1
Registered: October 2015
Junior Member
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 20:00 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

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 21:43 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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


_
Nitin Dahyabhai
Eclipse Web Tools Platform
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: Fri Apr 26 19:09:59 GMT 2024

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

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

Back to the top