blob: f44c9d857ad63406e220dfce03df93cab7b060a3 [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, 2007. 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">
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<title>Refactoring support</title>
</head>
<body>
<h1>Refactoring support</h1>
<p>The goal of Java program refactoring is to make system-wide code changes without affecting the behavior of the
program. The Java tools provide assistance in easily refactoring code.
</p>
<p>The refactoring tools support a number of transformations described in Martin Fowler's
book <span class="name">Refactoring: Improving the Design of Existing Code</span>, Addison Wesley
1999, such as <span class="name">Extract Method</span>, <span class="name">Inline Local
Variable, etc.</span></p>
<p>When performing a refactoring operation, you can optionally preview all
of the changes resulting from a refactoring action before you choose to carry them out.
When previewing a refactoring operation, you will be notified of potential
problems and will be presented with a list of the changes the
refactoring action will perform. If you do not preview a refactoring
operation, the change will be made in its entirety and any resultant
problems will be shown. If a problem is detected that does not allow
the refactoring to continue, the operation will be halted and a list of
problems will be displayed.</p>
<p>Refactoring commands are available from the context menus of several Java views (e.g. Package Explorer, Outline) and editors.
Many &quot;apparently simple&quot; commands, such as <strong>Move</strong> and <strong>Rename</strong>, are
actually refactoring operations, since moving and renaming Java elements
often require changes in dependent files.
</p>
<p>Refactorings can not only be performed interactively, but also from refactoring scripts. Most refactorings available in the <strong>Refactor</strong>
menu are stored in the workspace refactoring history in order to be used in refactoring scripts afterwards. The refactoring tools support the creation of refactoring
scripts based on refactorings in the workspace refactoring history. Refactoring scripts can then be applied to an arbitrary workspace. Applying a refactoring
script launches a refactoring wizard which is able to replay the refactorings as if they had been initiated by the user which originally had created them.
</p>
<p>Related to refactoring scripts, the refactoring tools offer a refactoring to migrate a JAR File to a newer version, using refactoring information
to avoid breaking changes in your workspace after the migration.
</p>
<p><img border="0" src="../images/ngrelt.png" alt="Related tasks"></p>
<p>
<a href="../tasks/tasks-240.htm">Creating refactoring scripts</a><br>
<a href="../tasks/tasks-241.htm">Applying refactoring scripts</a><br>
<a href="../tasks/tasks-242.htm">Browsing the refactoring history</a>
</p>
<p><img border="0" src="../images/ngrelr.png" alt="Related reference"></p>
<p>
<a href="../reference/ref-menu-refactor.htm">Refactoring actions</a><br>
<a href="../reference/ref-117.htm">Refactoring wizard</a><br>
<a href="../reference/ref-13.htm">Java preferences</a>
</p>
</body>
</html>