| <!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> |
| Renaming a method |
| </title> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| </head> |
| <body> |
| <h1> |
| Renaming a method |
| </h1> |
| <p> |
| You can rename a method by modifying its declaration in the compilation unit in which it is declared. However, if you also want to update |
| all references to it, you must either: |
| </p> |
| <ol> |
| <li> |
| In a Java view presenting methods (for example the Outline view) select the method to be renamed. |
| </li> |
| <li> |
| From the view's pop-up menu, select <strong>Refactor</strong> > <strong>Rename</strong> or select <strong>Refactor</strong> > <strong>Rename</strong> from the global menu bar. |
| </li> |
| </ol> |
| <p> |
| or |
| </p> |
| <ol> |
| <li> |
| In a Java editor, select a reference to or the declaration of the method to be renamed. |
| </li> |
| <li> |
| From the editor's pop-up menu, select <strong>Refactor</strong> > <strong>Rename</strong> or select <strong>Refactor</strong> > <strong>Rename</strong> from the global menu bar. |
| </li> |
| </ol> |
| <p> |
| <strong>Note 1:</strong> Renaming a method declared in an interface also renames (and updates all references to) all methods that are implementations of that method. |
| </p> |
| <p> |
| <strong>Note 2:</strong> When renaming a non-static method declared as public, package visible, or protected, all methods overriding it are also renamed and all references |
| to them are updated. |
| </p> |
| <p> |
| <strong>Note 3:</strong> Renaming a static method or a private method updates references only to that method. |
| </p> |
| <p> |
| <img src="../images/ngrelc.png" alt="Related concepts" border="0" > |
| </p> |
| <p> |
| <a href="../concepts/concepts-1.htm">Java development tools (JDT)</a> |
| </p> |
| <p> |
| <img src="../images/ngrelt.png" alt="Related tasks" border="0" > |
| </p> |
| <p> |
| <a href="tasks-87.htm">Extracting a method</a><br> |
| <a href="tasks-98.htm">Renaming method parameters</a> |
| </p> |
| <p> |
| <img src="../images/ngrelr.png" alt="Related reference" border="0" > |
| </p> |
| <p> |
| <a href="../reference/ref-dialog-override-method.htm">Override methods</a><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> |
| </p> |
| |
| </body> |
| </html> |
| |