Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Reformatting only part of a source file?
Reformatting only part of a source file? [message #152330] Mon, 05 April 2004 10:01 Go to next message
Eclipse UserFriend
The eclipse java editors reformat functionality is brilliant, except
for certain cases where one would like to maintain some hand-crafted
formatting, e.g. to maintain some special tabular arrangement of
initializers or some comments that contain some simple "ASCII drawing"
and similar occasions.

In such cases it would be VERY nice, if one could re-format only some
*selected* part of a .java-file. Is that somehow possible? If not, I
am considerung submitting this as a feature request...

Michael
Re: Reformatting only part of a source file? [message #152354 is a reply to message #152330] Mon, 05 April 2004 10:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: olivier_thomannNO.ca.ibm.comSPAM

>The eclipse java editors reformat functionality is brilliant, except
>for certain cases where one would like to maintain some hand-crafted
>formatting, e.g. to maintain some special tabular arrangement of
>initializers or some comments that contain some simple "ASCII drawing"
>and similar occasions.
>
>In such cases it would be VERY nice, if one could re-format only some
>*selected* part of a .java-file. Is that somehow possible? If not, I
>am considerung submitting this as a feature request...
No, this is not possible right now.
--
Olivier
Re: Reformatting only part of a source file? [message #152478 is a reply to message #152330] Mon, 05 April 2004 16:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: news-reply-200404.iclipse.org

"Michael Moser" <mmo@zurich.ibm.com> wrote:

>The eclipse java editors reformat functionality is brilliant, except
>for certain cases where one would like to maintain some hand-crafted
>formatting, e.g. to maintain some special tabular arrangement of
>initializers or some comments that contain some simple "ASCII drawing"
>and similar occasions.

The only thing that works is to correct the indentation of the code
per line. Select the lines you would like to be correctly indented and
select Source > Correct indentation. This does not reformat the line
wrappings though or any other nice stuff of the formatter.

>In such cases it would be VERY nice, if one could re-format only some
>*selected* part of a .java-file. Is that somehow possible? If not, I
>am considerung submitting this as a feature request...

You can submit it yourself on www.eclipse.org > Bugs.

Igor

--
Igor

the [i]clipse project
www.iclipse.org
Re: Reformatting only part of a source file? [message #152616 is a reply to message #152330] Tue, 06 April 2004 04:13 Go to previous message
Eclipse UserFriend
Michael Moser wrote:
> The eclipse java editors reformat functionality is brilliant, except
> for certain cases where one would like to maintain some hand-crafted
> formatting, e.g. to maintain some special tabular arrangement of
> initializers or some comments that contain some simple "ASCII drawing"
> and similar occasions.
>
> In such cases it would be VERY nice, if one could re-format only some
> *selected* part of a .java-file. Is that somehow possible? If not, I
> am considerung submitting this as a feature request...

Simply select the lines you want to format and choose Source->Format.
This will format the selection.

Note that comments can only be formatted as a whole currently, i.e. if
your selection includes part of a comment, the entire comment will be
formatted.

You should also try the "Format Element" command which is not available
from the menus but can be bound in the keybindings dialog. I use it
frequently to beautify a javadoc comment or single method without
changing everything else.

-tom
Previous Topic:RCP and M8
Next Topic:Tab shows up as compiler warning
Goto Forum:
  


Current Time: Tue Jul 22 16:22:20 EDT 2025

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

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

Back to the top