What is the Slice2Java Eclipse Plug-in?

Eclipse is a popular open-source development platform that includes an Integrated Development Environment (IDE) for Java programmers. ZeroC has created a Slice2Java plug-in for Eclipse that automates the translation of Slice files and manages the resulting generated code.

The Slice2Java plug-in provides the following features:

  • Handles all aspects of translating your Slice files
  • Incrementally recompiles Slice files after modifications
  • Maintains dependencies between Slice files
  • Highlights compilation errors in your source code
  • Manages the generated code to remove obsolete files automatically

The Slice2Java plug-in is only supported with Eclipse Ganymede (3.4).

Installation

ZeroC hosts an Eclipse plug-in site that you can add to your Eclipse configuration. Follow these steps to install the Slice2Java plug-in:

  1. From the Help menu, choose Software Updates
  2. Select the Available Software tab
  3. Click Add Site
  4. In the Location field, enter http://www.zeroc.com/download/eclipse
  5. Select the Slice2Java plug-in and click Install
The plug-in requires Ice 3.3.1 or later. Users of Ice for Android 0.1 may also use the plug-in but you must upgrade your Ice installation to version 3.3.1 or later.

Refer to the CHANGES file for a detailed history of the changes in each release.

Usage

Configuring the Ice SDK

Once Eclipse has finished installing the plug-in, it will recommend that you restart the IDE. After Eclipse has restarted, choose Preferences from the Window menu, select Slice2Java, and review the default setting for the location of your Ice installation. The property pane will display an error message if the plug-in considers the specified location to be invalid. If necessary, click Browse... to pick the top-level directory of your Ice installation and apply your changes.

Activating the Plug-in for a Project

After installing the plug-in, you can use it in your Eclipse project by right-clicking on the project, choosing Slice2Java and clicking Add Slice2Java builder. The plug-in immediately makes several additions to your project:

  • Creates a slice subdirectory to contain your Slice files. The plug-in automatically compiles any Slice file that you add to this directory.
  • Creates a generated subdirectory to hold the Java source files that the slice2java translator generates from your Slice files.
  • Adds a library reference to the Ice run time JAR file (Ice.jar) for non-Android projects. The plug-in assumes that the JAR file resides in the lib subdirectory of your Ice installation.

Configuring Project Settings

To configure the Slice2Java plug-in, select Properties from the Project menu or right-click on the name of your project and choose Properties. Click on Slice2Java Properties to view the plug-in's configuration settings, which are presented in three tabs:

Source

This tab configures the directories of your Slice files and generated code. The plug-in includes the slice subdirectory by default, but you can remove this directory and add other directories if necessary. The plug-in only compiles Slice files that are located in the configured subdirectories.

For the generated code, the plug-in uses the default name generated for the subdirectory. If you want to store your generated code in a different directory, you must first create the directory and then click Browse to select it. Be aware that the plug-in requires exclusive use of the subdirectory you designate, therefore you must not place other project resources in it.

Options

This tab is where you configure additional plug-in settings. You can enter a list of include directories corresponding to the compiler's -I option. You can also specify preprocessor macros and metadata definitions in the fields provided. Finally, checkboxes offer additional control over certain features of the plug-in and the Slice compiler. When enabled, the checkboxes have the following semantics:

  • Enable stream generates code to support the dynamic streaming API
  • Enable tie generates TIE classes
  • Enable ice instructs the compiler to accept Slice symbols that use the ice prefix
  • Include Ice Slice Files adds an implicit include (-I) option that refers to the slice subdirectory of your Ice installation
  • Enable console causes the plug-in to emit diagnostic information about its activities to Eclipse's console
  • Enable underscore (Ice 3.4.1 only) determines whether underscores are permitted in Slice identifiers (this feature is only supported in Ice 3.4.1 or later)

Libraries

This tab allows you to configure the Ice JAR files with which your application is built. The check box labeled Add JAR file references to project determines whether the plug-in adds an Ice Library entry to your project's build path. This check box is enabled by default, but you may want to disable it if the Ice JAR files are already present in your build path.

During a build, the Ice Library entry is substituted with the JAR files that you have added to the list.

Note that Android projects cannot use the Ice Library indirect reference, therefore you must manually add IceAndroid.jar to your build path:

  1. Select Java Build Path in the project's properties
  2. Click on the Libraries tab
  3. Click Add External JARs... and choose IceAndroid.jar
  4. Click OK to save your changes

The plug-in always rebuilds a project after its properties have been changed, but it may be necessary to refresh the project after changing a project's build path. To refresh a project, select it and press F5, or right-click on the project and choose Refresh.

Source Code

In order to build the plug-in, you will need an installation of Eclipse Ganymede (3.4) suitable for plug-in development.

Slice2JavaPlugin-3.3.1.20100706.tar.gz
Slice2JavaPlugin-3.3.1.20100706.zip

Eclipse projects containing the source code for the Slice2Java plug-in version 3.3.1.

CHANGES

A detailed history of the changes in each release.

Terms of Use | Privacy © 2010 ZeroC, Inc.