Refactoring Browser


For the latest information on the Refactoring Browser see the HyperNews page.


The Refactoring Browser is an advanced browser for VisualWorks, VisualWorks/ENVY, and IBM Smalltalk. It includes all the features of the standard browsers plus several enhancements. Some of its enhancements are:

  • Buffers: You can edit many methods at the same time without opening other browsers. For example, while you are editing one method, you can switch to a new buffer to lookup some value in another method, and then return back to your edited method without opening a new browser.
  • Drag & drop: You can drag & drop methods on classes or protocols; protocols on other classes or on protocols; classes on other categories; and categories on other categories.

  • Hierarchy: You can easily switch between a hierarchy view and the normal category view without spawning a hierarchy view window. This picture shows the hierarchy view on the VisualLauncher class. Also, it shows a resource viewer displaying an icon.
  • Lint: Automatically look for over 60 types of common Smalltalk bugs in your program.
  • Menus: The browser has window menus, so you can use the short-cut keys for selecting items from the menu and rely less on the mouse.
  • Multi-window: You can have many different code tools in different windows with only one navigator controlling them. In this mode, only the top most code tool will be updated when you change the navigators selection. If you want to use the multi-window browser, see the customization section below.

  • Old methods: No more accidentally accepting changed methods. Whenever you change a method in one window, all other browsers viewing the methods will turn their code tools red until you update their code or accept the method. If you do not like the color selection, you can change it in BrowserCodeTool>>modifiedTextColor.
  • Refactorings: Automatically perform some behavior preserving transformations such as abstracting references to an instance variable. Many of the refactorings are from Bill Opdyke's thesis.
  • Resource viewers: View resource methods in their more natural look instead of text. For example, a menu resource method appears as menu, not as text, although you can switch to a textual view if you want. This picture shows a canvas viewer viewing the ClassNavigator>windowSpec method.

  • Rewrite tool: Specify new rules to make source to source transformations. For example, you can create a rule to automatically convert uses of "aCollection size == 0" to be "aCollection isEmpty". Documentation for the rewrite tool can be found on this page.
The icons signify that the feature is not implemented for IBM Smalltalk.

Installation:

To install the Refactoring Browser, you will need to download either the compressed tar file or all the .st files in this directory. If you are installing the browser under an ENVY environment, then you just need the ENVY-Browser.zip file. This file contains both the VisualWorks and the VisualAge versions.

To install the browser in an ENVY environment, you need to decompress the ENVY-Browser.zip file to create the Browser.dat file. Once you have done this, you'll first import the "Refactoring Browser" configuration map for the browser into ENVY and then load the config map for the browser.

If you are using plain VisualWorks, then there are two ways to install the Refactoring Browser. You can either file-in the install.st file or file-in the files by hand. The install.st file tries to analyze your system to see what files are needed and should work for most installations. If you wish to install the browser manually, you'll need to file-in these files:

Uninstall-old.st
File-in this file if you have installed a previous version of the Refactoring Browser. Since the new version has refactored many classes significantly, it is easier to uninstall the old version instead of filing-in fixes.
Parser.st
This is a parser that is portable between VisualWorks and IBM ST.
Browser.st
This is the main sources file for the browser.
ProgressWidget.st
This file is not included with the browser, but it can be found in the /pub/Smalltalk/st80_vw directory on st. More information about the progress widgets can be found on this page.
Launcher.st
This file adds the buttons to start the browser and lint tools to the launcher and opens a new launcher. If you don't want to modify your launcher, you can evaluate "RefactoringBrowser open" to open the browser and "Smalllint open" to open the lint tool.
DragDropLauncher.st
This file adds the drag & drop support for the refactoring browser to the icon on the launcher. It should only be filed-in if you have filed-in both the DragDrop.st and Launcher.st files above.
Fixes files
You should also file in all of the fixes files from the browser's source directory. These files include both fixes and enhancements to the browser.

Other Refactoring Information:


User instructions:

To open the refactoring browser select the [ ]button or evaluate "RefactoringBrowser open". If you're using ENVY, then you can select the "RefactoringBrowser" from the ENVY menu in the launcher. This will open a window that is similar to this picture.

The refactoring browser should be very familiar to people using the standard system browser since many of its items are the same. As a result, only the new menu items are listed:

All of the menu items above are refactorings except for the Buffer menu items and the rewrite editor.


Customization:

The new browser was designed to be extensible and customizable. There are several methods that you can modify and/or execute to change its behavior.

  • Multi-window support: You can change the browser so that each code tool is opened in a new window, instead of creating buffers for each tool. To change the browser to be multi-window evaluate "RefactoringBrowser beMultiWindow", and to change it back to single window mode evaluate "RefactoringBrowser beSingleWindow". Once you evaluate either selection, you must open a new browser.
  • Vertical navigators: You can change the navigator from it's default horizontal position to a vertical one by evaluating "RefactoringBrowser beVertical" and switch it back to horizontal by evaluating "RefactoringBrowser beHorizontal".
  • Resource editors: You can change the editor and/or viewer for a resource (menus, canvases, etc.) by changing ResourceTool>initialize method. For example, to change the menu editor, so that the new VisualWorks 2.5 enhanced menu editor is opened, change UIMenuEditor to MenuEditor, and then re-initialize the ResourceTool class.
  • Code tools: You can create a new code tool and add it to the browser by modifying the CodeModel>codeToolClass method. This method determines which code tool is used for the navigator's selection. Code tools can be created by creating a subclass of CodeTool, defining its interface functions, and defining the updateContents method. The updateContents message is sent to the code tool so that the code tool can stay current with the navigator's selection.

Bugs/Limitations:

This section lists the known bugs and their work arounds (if they exist). If you know of a bug that is not listed in this section, please mail us. If we know of the bug, we might fix it, but we can't fix bugs that we don't know about :).


Comments or suggestions can be sent to brant@cs.uiuc.edu and droberts@cs.uiuc.edu.
Last updated on 29-Apr-97.