| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| <head> |
| <meta name="copyright" content= |
| "Copyright (c) IBM Corporation and others 2000, 2011. 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=utf-8" /> |
| <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> |
| To get an overview of all offered refactorings look at the <a href= |
| "../reference/ref-menu-refactor.htm"><b>Refactor menu</b></a>. Refactoring commands are also |
| available from the context menus in many views or appear as <a href= |
| "../reference/ref-java-editor-quickassist.htm"><b>quick assists</b></a>. |
| </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 "apparently simple" 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> |
| |
| <h3 class="related">Related references</h3> |
| <a href="../reference/ref-menu-refactor.htm">Refactoring actions</a><br /> |
| <a href="../reference/ref-wizard-refactorings.htm">Refactoring wizard</a><br /> |
| <a href="../reference/preferences/ref-preferences-java.htm">Java preferences</a> |
| </body> |
| |
| </html> |