blob: 5ae690b6f31254c4ae72ba505feaea7e4e93305d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<title>
Formatting files or portions of code
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
</head>
<body>
<h1>
Formatting files or portions of code
</h1>
<p>
To format Java code:
</p>
<ol>
<li>
Use the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeFormatterPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png">
<strong>Java &gt; Code Style &gt; Formatter</strong></a> preference page to
specify your preferences for code formatting.
</li>
<li>
Open a Java file and select the code you want to format. If nothing is selected, then all of the editor content is formatted.
</li>
<li>
Format the code by either
<ul>
<li>
Selecting <strong>Source</strong> &gt; <strong>Format</strong> from the editor's pop-up menu or
</li>
<li>
Pressing <strong>Ctrl+Shift+F</strong> or
</li>
<li>
Selecting <strong>Source</strong> &gt; <strong>Format</strong> from the menu bar.
</li>
</ul>
</li>
</ol>
<p>
<img src="../images/ngrelc.png" alt="Related concepts" border="0" >
</p>
<p>
<a href="../concepts/concepts-1.htm">Java development tools (JDT)</a><br>
<a href="../concepts/concepts-7.htm">Java editor</a>
</p>
<p>
<img src="../images/ngrelt.png" alt="Related tasks" border="0" >
</p>
<p>
<a href="tasks-54.htm">Using the Java editor</a><br>
<a href="tasks-66.htm">Formatting Java code</a><br>
<a href="tasks-68.htm">Setting code formatting preferences</a>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference" border="0" >
</p>
<p>
<a href="../reference/ref-menu-source.htm">Source menu</a><br>
<a href="../reference/ref-17.htm">Code Formatter preferences</a>
</p>
</body>
</html>