blob: 1cc3a96480fe0c92080174602a4beef57c62d7cb [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//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>
Refactor actions
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1>
Refactor actions
</h1>
<p>
Refactor menu commands:
</p>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Function
</p>
</th>
<td>
<strong>Keyboard Shortcut</strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<p>
Rename
</p>
</td>
<td align="left" valign="top">
<p> Starts the Rename refactoring dialog:&nbsp; Renames the selected element
and (if enabled) corrects all references to the elements (also in other
files). Is available on methods, method parameters, fields, local variables,
types, type parameters, enum constants, compilation units, packages, source folders, projects and on a
text selection resolving to one of these element types.&nbsp; </p>
</td>
<td>
Alt + Shift + R
</td>
</tr>
<tr>
<td align="left" valign="top">
<p>
Move
</p>
</td>
<td align="left" valign="top">
<p> Starts the Move refactoring dialog: Moves the selected elements and
(if enabled) corrects all references to the elements (also in other files).
Can be applied to one instance method (which can be moved to a component),
one or more static methods, static fields, types, compilation units, packages,
source folders and projects and on a text selection resolving to one of
these element types.&nbsp; </p>
</td>
<td>
Alt + Shift + V
</td>
</tr>
<tr>
<td>Change Method Signature </td>
<td>
<p>Starts the Change Method Signature refactoring dialog. Changes parameter
names, parameter types, parameter order and updates all references to
the corresponding method. Additionally, parameters can be removed or added
and method return type as well as its visibility can be changed. This
refactoring can be applied to methods or on text selection resolving to
a method.&nbsp; </p>
</td>
<td>&nbsp;</td>
</tr>
<tr align="left" valign="top">
<td>
Extract Method
</td>
<td> Starts the Extract Method refactoring dialog. Creates a new method containing
the statements or expression currently selected and replaces the selection
with a reference to the new method. You can use&nbsp;<em>Expand Selection
to</em> from the <a href="ref-menu-edit.htm">Edit</a> menu to get a valid
selection range.<br>
This feature is useful for cleaning up lengthy, cluttered, or overly-complicated methods.&nbsp;
</td>
<td>
Alt + Shift + M
</td>
</tr>
<tr align="left" valign="top">
<td> Extract Local Variable </td>
<td>
<p>Starts the Extract Variable refactoring dialog. Creates a new variable
assigned to the expression currently selected and replaces the selection
with a reference to the new variable. This refactoring is available on
text selections that resolve to local variables. You can use&nbsp;<em>Expand
Selection to</em> from the <a href="ref-menu-edit.htm">Edit</a> menu to
get a valid selection range. </p>
</td>
<td>
Alt + Shift + L
</td>
</tr>
<tr>
<td>Extract Constant</td>
<td>
<p>Starts the Extract Constant refactoring dialog. Creates a static final
field from the selected expression and substitutes a field reference,
and optionally rewrites other places where the same expression occurs.
This refactoring is available on static final fields and text selections
that resolve to static final fields.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr align="left" valign="top">
<td> Inline</td>
<td> Starts the Inline refactoring dialog. Inlines local variables, methods
or constants. This refactoring is available on methods, static final fields
and text selections that resolve to methods, static final fields or local
variables.</td>
<td>
Alt + Shift + I
</td>
</tr>
<tr>
<td>Convert Anonymous Class to Nested</td>
<td>
<p>Start the Convert Anonymous Class to Nested Class refactoring dialog.
Helps you convert an anonymous inner class to a member class. This refactoring
can be applied to anonymous inner classes.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Convert Member Type to Top Level</td>
<td>
<p>Starts the Convert Member Type to Top Level refactoring dialog.
Creates a new Java compilation unit for the selected member type, updating
all references as needed. For non-static member types, a field is added
to allow access to the former enclosing instance, if necessary.
This refactoring can
be applied to member types or text resolving to a member type.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Convert Local Variable to Field</td>
<td>
<p>Start the Convert Local Variable to Field refactoring dialog. Turn a
local variable into a field. If the variable is initialized on creation,
then the operation moves the initialization to the new field's declaration
or to the class's constructors. This refactoring is available on text
selections that resolve to local variables.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Extract Superclass</td>
<td>
<p>Starts the Extract Superclass refactoring dialog. Creates a new class
with a set of methods and fields and makes the selected class extend the class,
optionally changing references to the class to the new superclass wherever
possible. This refactoring can be applied to types.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Extract Interface</td>
<td>
<p>Starts the Extract Interface refactoring dialog. Creates a new interface
with a set of methods and makes the selected class implement the interface,
optionally changing references to the class to the new interface wherever
possible. This refactoring can be applied to types.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Use Supertype Where Possible</td>
<td>
<p>Starts the Use Supertype Where Possible refactoring dialog. Replaces occurrences
of a type with one of its supertypes after identifying all places where
this replacement is possible.This refactoring is available on types.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Push Down</td>
<td>
<p>Starts the Push Down refactoring dialog. Moves a set of methods and fields
from a class to its subclasses. This refactoring can be applied to one
or more methods and fields declared in the same type or on a text selection
inside a field or method.&nbsp; </p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top">Pull Up</td>
<td align="left" valign="top">
<p> Starts the Pull Up refactoring wizard. Moves a field or method to a
superclass of its declaring class or (in the case of methods) declares
the method as abstract in the superclass. This refactoring can be applied
on one or more methods, fields and member types declared in the same type
or on a text selection inside a field, method or member type.&nbsp; </p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Introduce Indirection</td>
<td>
<p>Starts the Introduce Indirection refactoring dialog. Creates a static indirection method delegating to the selected method. If selected, all
calls to the orginal method are replaced by calls to the indirection method.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<tr>
<td>Introduce Factory</td>
<td>
<p>Starts the Introduce Factory refactoring dialog.
This will create a new factory method, which will call a selected
constructor and return the created object. All references to the constructor will be
replaced by calls to the new factory method.
This refactoring is available on constructor declarations.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Introduce Parameter</td>
<td>
<p>Starts the Introduce Parameter refactoring dialog. Replaces an expression
with a reference to a new method parameter, and updates all callers of the
method to pass the expression as the value of that parameter.
This refactoring is available on text selections that resolve to expressions.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td> Encapsulate Field </td>
<td> Starts the Self Encapsulate Field refactoring dialog. Replaces all references
to a field with getting and setting methods. Is applicable to a selected
field or a text selection resolving to a field. </td>
<td>&nbsp;</td>
</tr>
<!-- -- -->
<tr>
<td>Generalize Declared Type</td>
<td>
<p>Starts the Generalize Declared Type refactoring dialog. Allows the user to choose
a supertype of the reference's current type. If the reference can be safely changed to the
new type, it is. This refactoring can be applied to type references and declarations
of fields, local variables, and parameters with reference types.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Infer Generic Type Arguments</td>
<td>
<p>Starts the Infer Generic Type Arguments refactoring dialog. Replaces raw type occurrences
of generic types by parameterized types after identifying all places where
this replacement is possible.This refactoring is available on projects, packages and types.</p>
</td>
<td>&nbsp;</td>
</tr>
<!-- -- -->
<tr>
<td>Migrate JAR File</td>
<td>
<p>Starts the Migrate JAR File dialog. Updates
a JAR file in your build path with refactoring information contained
in a newer version of the JAR file.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Create Script</td>
<td>
<p>Starts the Create Script dialog. Creates a script of the refactorings that have been applied
in the workspace. Refactoring scripts can either be saved to a file or
kept in the clipboard. See <em>Apply Script</em>.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Apply Script</td>
<td>
<p>Starts the Apply Script dialog. Applies a refactoring script to projects in your workspace.
Refactoring scripts can either be loaded from a file or from the clipboard.</p>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>History</td>
<td>
<p>Starts the Refactoring History dialog. Lets you browse, inspect, and remove
refactorings from all projects in the workspace.</p>
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<p>
Refactoring commands are also available from the context menus in many views and the Java editor.
</p>
<p>
<img border="0" src="../images/ngrelc.png" alt="Related concepts" >
</p>
<p>
<a href="../concepts/concepts-9.htm">Refactoring support</a>
</p>
<p>
<img border="0" src="../images/ngrelt.png" alt="Related tasks" >
</p>
<p>
<a href="../tasks/tasks-80.htm">Refactoring</a><br>
<a href="../tasks/tasks-176.htm">Using Structured Selection</a>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference">
</p>
<p>
<a href="ref-117.htm">Refactoring dialogs</a><br>
<a href="ref-154.htm">Extract Method Errors</a><br>
<a href="ref-13.htm">Java preferences</a><br>
</p>
</body>
</html>