Chapter 11. Seam Refactoring Tools

11.1. Using the Refactorinig Wizard
11.2. Renaming Seam Components
11.2.1. Renaming Seam Components in the Java Editor
11.2.2. Renaming Seam Components in the Seam Components View
11.2.3. Renaming Seam Components in the Seam Components Editor
11.3. Renaming Seam Context Variables in EL

The goal of Seam components refactoring is to make system-wide code changes without affecting the behavior of the program. The Seam module of JBoss Tools provides assistance in easily code refactoring.

Starting from Jboss Tools M4 refactoring functionality became also available for managed beans, method and properties used in ELs. Thus now Seam refactoring tools include the next refactoring operations:

Refactoring commands are available from the context menus of several views and editors and use a standard Eclipse refactoring wizard. For details, see "Using the Refactoring Wizard" later in this chapter.

Note:

Seam refactoring could be only performed in the file that is not marked as Read only in its properties.

Properties View for Java File

Figure 11.1. Properties View for Java File


This wizard is opened always when the user clicks Rename Seam Component/Rename Seam Context Variable/Rename command in any of the mentioned views.


In the Seam Components name field you should enter a new name of the component, then click Next and follow the next wizard steps:


As you see, when performing a refactoring operation, you can preview all of the changes resulting from a refactoring action before you choose to carry them out.

The view represents two windows: one with the original source code and the other with refactored one.

With the help of , , , buttons you can quickly navigate between the differences in the code. If you don't agree with some changes you can't undo them but you can remove the class from the list of classes that need refactoring.


To apply the changes click Finish.

Renaming the selected seam component also corrects all references to the component (also in other files in the project). Renaming a type doesn't allow to rename similarly named variables and methods.

Renaming a Seam component could be performed in the:

Renaming a Seam context variables in EL could be executed in .java, .xml, .jsp, .xhtml and .properties files in Seam projects using the context menu command Seam Refactor > Rename Seam Context Variable.