General Usage

This section reviews the general aspects of the user interface which are not specific to any one refactoring feature. It also reviews user interface features which are unrelated to refactoring.

Eclipse Workbench

It is beyond the scope of this document to describe the Eclipse Workbench in any detail, however, a few quick notes and terms will make the rest of this chapter more understandable if you are new to Eclipse.

Workbench
Eclipse's Workbench is the entire Eclipse window and all of its contents. You may on occasion have more than one workbench active, but normally you would only work in one workbench at a time.
Workspace
A workspace consists of the list of the list of projects and settings that you see in your workbench.
Project
This term has the same meaning as most other IDEs. A project has a single, top-most directory, which in turn contains all of your project's sub-folders and files.
Resource
A resource in Eclipse is a project, a directory, or a file. In simple terms, it is anything that you might see in the Navigator view.
View
Within the workbench window, you can find various frames which are separated by movable splitter bars. In Eclipse, these frames are called views. Access to most views is through a tabbed interface. Examples of views are the Navigator view, the Outline view, the Console view, and the Tasks view.
Editor
Editors in Eclipse treated differently than views. Multiple editors can be open with a tabbed interface, and can be an unlimited number of types of editors within your Eclipse workbench. For example, there is an editor for plain text, there is an editor for Java, and there is an editor for C++.
Perspective
A perspective describes an arrangement and visibility of the various elements on the workbench. That includes the menus, button bars, views, and editors. There are default perspectives for Java, Java Debugging, for ProRefactor, and for many other plug-ins. Although perspectives all come with a default layout, those layouts can be modified. Eclipse remembers your layout changes.
Plug-in
Eclipse uses a plug-in architecture. This means that the Eclipse core is extremely small, and most of the elements that you see on the Eclipse workbench are actually contributed by plug-ins - even those elements of the workbench which are part of the basic workbench. There are also plug-ins which are not part of the basic workbench, and those include Java and C++ plug-ins which are part of the Eclipse.org project, as well as third-party plug-ins such as ProRefactor.

Menus

ProRefactor contributes menus to various parts of the Eclipse workbench. By default, these ProRefactor menus are only available when you are in the ProRefactor perspective. In the main menu bar, across the top of the workbench window, a ProRefactor menu is available.

The ProRefactor plug-in contributes a context sub-menu to the Navigator view. A context menu is a pop-up menu which is available by using right-mouse-click.

The ProRefactor plug-in also contributes a context menu to editors such as Eclipse's Text Editor.

Operating on Many Resources

Some features of ProRefactor are only available for a single compile unit at a time. However, some features are capable of operating on a selection of one or more resources, as selected in Eclipse's Navigator view. In the Navigator view, you can select one or more files, directories, projects, or any combination of these.

Once the desired resources have been selected, the Navigator context menu shows what operations may be performed on those. There is a ProRefactor sub-menu on the Navigator's context menu.

Expand and Contract Selection

Sometimes when viewing poorly formatted source code, it is difficult to find where a block begins and ends. ProRefactor provides a feature which can help.

ProRefactor contributes two buttons to the button bar which are called Expand Selection and Contract Selection. These actions are also available from the editor's context menu. This feature only works on source files which can be compiled. (i.e. It does not currently work within an include file if that file can not be compiled on its own.)

Simply place your cursor in the editor anywhere within the block of code that you are interested in, and choose Expand Selection. ProRefactor will parse the file, and then select some of the text in the editor around where your cursor was placed.

Expand and Contract Selection selects text by finding the begin and end points for the source code for a node in Proparse's syntax tree. By choosing Expand Selection repeatedly, you can climb the nodes in the syntax tree until you have selected the text for the code block that you are interested in.

Parse

The menu item Parse can be found on the main menu under ProRefactor, as well as on the Navigator view's ProRefactor context menu. This causes ProRefactor to parse the selected resource(s). For example, you can select your entire project (or multiple projects), and choose Parse in order to parse all of the compile units in those projects.

ProRefactor considers .p, .w, and .cls files to be compile units. This may be configurable in future versions.

ProRefactor stores information about your compile units, and it uses this information to determine if the compile unit needs to be re-parsed. It does this by checking the time stamps on the compile unit and all the include files that it references.

Output Directory

Most of the refactorings in ProRefactor make use of a wizard style of interface, with one or more pages to be reviewed before launching.

Some of the refactorings, especially those which process any number of resources, write their results out to a temporary directory.

The target directory that you select must exist, and it must be empty. Choosing the Browse button presents you with a dialog from which you can choose or create a directory.

Typically, once the refactoring has been completed, you will want to review the newly changed code before copying it into your project directory. See Links and Resources for some free tools which ease the process of reviewing many changes.