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.
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.
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.
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.
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.
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.
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.