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
Solved

eclipse formatting

Posted on 2016-11-05
6
105 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
  • 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 42
runtime exception 2 41
Java string replace 11 53
Tagging and Merging on Branch 1 29
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

789 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