馮輝寧
Thomas Huining Feng

Ptolemy II Plugin for Eclipse


1. Features

Currently, two main features are provided. New features will be added shortly.

1.1. Refactoring for backtracking

This plugin supports refactoring of Java source code for backtracking purpose. (Details and explanation of backtracking can be found in Backtracking in Ptolemy II.) Users may perform this refactoring within Eclipse, simply by clicking a button.

Batch refactoring provides a way to refactor a list of Java source files at a time.

Batch refactoring menu

Figure 1. Batch refactoring menu


The list of files to be refactored can be easily configured in the "Options" dialog. As the result of batch refactoring, all the listed source files are transformed in such a way that they support backtracking.

Batch refactoring options

Figure 2. Batch refactoring options


In addition to batch refactoring, instantaneous preview of the refactored version is also provided by the Ptolemy editor, an enhansion of the Eclipse built-in Java editor. (Once the plugin is installed, Java source files are opened with Ptolemy editor by default.) Ptolemy actor designers are then able to see how the refactored version looks like as they input the code in the editor.

1.2. Ptolemy semantic highlighting

Ptolemy actor designers, though they write Java code directly, must follow certain Ptolemy conventions, such as overriding the prefire, fire, postfire functions. In the Ptolemy editor, such special functions are highlighted with red color and bold face. Private fields of the classes, as they will be refactored, are made clear in orange. These highlighting colors and faces can be customized in the Ptolemy options.

Ptolemy editor

Figure 3. Ptolemy editor


2. Requirements

This plugin adds Ptolemy programming support to the Eclipse framework. Eclipse 3.0 or higher is required.

In Eclipse 3.0, Ptolemy-style syntax highlighting is turned OFF by default. This is because the syntax highlighting API in 3.0 has internal bugs that make it unreliable. In Eclipse 3.1, this problem is fixed, so this functionality is turned ON by default.

This plugin is tested on both Windows XP and Fedora Core 4 (with its native Eclipse distribution).

3. Installation

Current Alpha release of the plugin is available here: ptolemy.backtrack_0.1.3.jar (build 07/04/2008).

You should see the "Ptolemy" menu and toolbar icon, when you open Eclipse after installing the plugin.

Ptolemy menu and toolbar in Eclipse

Figure 4. Ptolemy menu and toolbar in Eclipse


There are two approaches to have this plugin installed in your Eclipse framework. Please take either of the following.

3.1. Install with the Eclipse update facility

  1. Open Eclipse if it is not running.

  2. Select "Help -> Software Updates -> Find and Install..." from the Eclipse menu.

  3. Choose "Search for new features to install". Click "Next".

  4. For the first time, the update site must be added to the list. Click "New Remote Site...". Enter "Ptolemy II update site" as the name of the update site, and enter "http://www.eecs.berkeley.edu/~tfeng/projects/update/" as the URL. Click "OK" when done.

    Update sites

    Figure 5. Update sites


  5. Click "Finish" and Eclipse will connect to the update site and fetch necessary information to install the plugin.

  6. Follow the instructions to complete the process. It is necessary to restart Eclipse to enable the plugin.

  7. Once the plugin is installed, you may update it from the same server with Eclipse update.

3.2. Install manually

  1. Close Eclipse if it is running.

  2. Assume that Eclipse is installed in directory <%ECLIPSE%>. Open folder <%ECLIPSE%>\plugins. If a previous version of this plugin (which may or may not have the same file name as the latest release) is installed, remove it.

  3. Download the current release and put the downloaded file in <%ECLIPSE%>\plugins. Do NOT extract it.