blob: c10f1e071fb48e16bb7d7e00a3fe5d50c0793fbf [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">
<title>
Replacing a local variable with a query
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1>
Replacing a local variable with a query
</h1>
<p>
To replace a local variable with a query:
</p>
<ul>
<li>
In the Java editor, select the expression with which the local variable is initialized
</li>
<li>
Invoke the Extract Method refactoring by either:
<ul>
<li> Selecting <strong>Refactor &gt; Extract Method</strong> from the editor's
pop-up menu or </li>
<li> Selecting <strong>Refactor &gt; Extract Method</strong> from the menu
bar </li>
</ul>
</li>
<li>
Perform the Extract Method refactoring
</li>
<li>
Select the local variable (or a reference to it)
</li>
<li>
Invoke the Inline Local Variable by either:
<ul>
<li> Selecting <strong>Refactor &gt; Inline</strong> from the editor's pop-up
menu or </li>
<li> Selecting <strong>Refactor &gt; Inline</strong> from the menu bar </li>
</ul>
</li>
<li>
Perform the Inline Local Variable refactoring
</li>
</ul>
<img src="../images/ngrelc.png" alt="Related concepts" border="0" > <br>
<a href="../concepts/concepts-1.htm">Java development tools (JDT)</a>
<p>
<img src="../images/ngrelt.png" alt="Related tasks" border="0" ><br>
<a href="tasks-87.htm">Extracting a method</a><br>
<a href="tasks-161.htm">Inlining a local variable</a>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference" border="0" ><br>
<a href="../reference/ref-menu-refactor.htm">Refactoring actions</a><br>
<a href="../reference/ref-117.htm">Refactoring dialogs</a><br>
<a href="../reference/ref-13.htm">Java preferences</a><br>
</p>
</body>
</html>