Solved

eclipse formatting

Posted on 2016-11-05
6
117 Views
Last Modified: 2016-11-14
Hi,
In eclipse when i write code and to format i press Control+Shift+F keys together. it is formatting as attached on contl1 attachment where
for(){//here i want { in next line 

Open in new window


But i want formatting as in attachment contl2 so that
 { is in next line which is same vertical line as closing } 

Open in new window

so that i understand easily where control block starting and ending. how to achieve this custom formatting in eclipse please advise
contl1.png
contl2.png
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
Amitkumar Panchal earned 250 total points
ID: 41875922
Hi,

I found that code in both the images are of same formatting.

However, you can control the formatting through the option under Window->Preferences->Java->Code Style->Formatter, then click the "Edit.." button.

Refer : http://www.wikihow.com/Change-the-Default-Format-Settings-in-Eclipse
0
 
LVL 35

Assisted Solution

by:mccarl
mccarl earned 250 total points
ID: 41876447
And to add to Amit's answer, because it can be a little hard to find. Once, you click the Edit button as above, then go to the "Braces" tab and change all the options from "Same line" to... "Next line"
0
 
LVL 7

Author Comment

by:gudii9
ID: 41876494
oops i missed right screenshot. I attached actual screenshot on how i want my formatting. If you see line 8 you see there is no { instead it moved to line 9 which makes more appealing to my eyes. please advise
pyramidFormat.png
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:mccarl
ID: 41876578
please advise

We already did!! Did you miss the rest of Amit's post or my post?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41879313
I found that code in both the images are of same formatting.

However, you can control the formatting through the option under Window->Preferences->Java->Code Style->Formatter, then click the "Edit.." button.

Refer : http://www.wikihow.com/Change-the-Default-Format-Settings-in-Eclipse

after changing if i want go back to original default how to do that?
0
 
LVL 35

Expert Comment

by:mccarl
ID: 41880479
Just change it back
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java exception bubble up 2 24
type mismatch (Object[] to double[] 4 41
Running JavaFX on JDeveloper 12C 1 79
Java Inheritance super keyword use 8 40
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question