The Java Developer's Guide to Eclipse The Java Developer's Guide to Eclipse

In Chapter 10, Creating Applications using the Rich Client Platform, you learned why Eclipse has succeeded in bringing one of the best tool integration platforms to the market. The long-awaited goal of "Java on the desktop" is only steps away. The authors of this book have every reason to expect that the future's best office applications will be based on Eclipse. To demonstrate a small part of this possibility, this chapter's example is the "Mini-Workplace."

Mini-Workplace

Running the Example

Import the following projects from the CD-ROM:

  1. com.ibm.jdg2e.miniwp (the "main" plug-in)
  2. com.ibm.jdg2e.msseditor.common
  3. com.ibm.jdg2e.msseditor.extras
  4. com.ibm.jdg2e.msseditor.miniwp
  5. com.ibm.jdg2e.views.extras

Next, open the project's launch configuration by selecting Run > Run... > JDG2E Mini-Workplace. Turn to the Plug-ins page and verify the example's plug-ins under Workspace Plug-ins are selected. If you've created or imported other plug-in projects, you may see them checked on the list; if so, deselect them.

Hint: A handy trick for getting the required plug-ins in a launch configuration correctly set is to turn to the Plug-ins page and then:

  1. Select Deselect All
  2. Select the plug-ins from the example shown below
  3. Select Add Required Plug-ins.

This sequence of selections is depicted below:

Launch configuration's Plug-ins page

Although the Mini-Workplace is an RCP application, the Workbench creates a workspace directory to store Eclipse metadata. The launch configuration specifies runtime-workspace-miniwp so it will be independent of your other test workspaces.

Running the Example as a Product

All of the book's plug-in examples are packaged on the CD-ROM ready for import into your workspace. To demonstrate the results of following the steps described in Chapter 13, Defining Features and Products, the CD-ROM also includes a ready-to-launch product version of this example in the rcp_miniwp_product directory. When launched as a product, the Mini-Workplace includes finishing touches like a splash screen and a customized About dialog, and excludes development-time artifacts like source code and .project files.

You can launch it directly from the CD-ROM by double-clicking the start-rcp-miniwp-product.bat file, which will in turn call java.exe with the correct parameters to start the Mini-Workplace. Most "real world" Eclipse-based products would likely wrapper the eclipse.exe with their own executable to handle startup operations like parameter checking and verifying the installation before calling Eclipse's executable; however this example uses a batch file so you can easily examine its startup parameters.

Note: For licensing reasons, the CD-ROM does not include a JRE for this example; otherwise it would be located in the rcp_miniwp_product\eclipse\jre directory. Subsequently the example assumes a Java Runtime Environment is installed and its bin directory is included in the system PATH variable to launch.

Roadmap of the Example

All RCP applications begin with the same minimal set of players, namely the application plug-in, which implements the IPlatformRunnable interface, the WorkbenchAdvisor subclass that coordinates the creation of the Workbench window, and a class implementing IPerspectiveFactory that is responsible for the page layout.

The "main" plug-in of this example is in the project com.ibm.jdg2e.miniwp. To make for a more compelling demonstration of Eclipse's integration capability, this example brings together several plug-ins from other chapters.

To learn more about this example, begin by examining the Mini-Workplace plug-in manifest; it details the relationships between the plug-ins composing the example and the standard RCP classes. Next turn to the MiniWPWorkbenchAdvisor, since that is where most of the real work is done.

Class (All) Description
MiniWPApplicationRunnable This IPlatformRunnable implementor is responsible for initializing the Workbench. The plug-in application is declared by extending the org.eclipse.core.runtime.applications extension point and specifying its identifier as an -application command line option.
MiniWPPerspectiveFactory This perspective factory generates the initial page layout and visible action set for the Mini-Workplace. It is declared by the org.eclipse.ui.perspectives extension point.
MiniWPWorkbenchAdvisor The Workbench advisor determines things like what perspective is initially displayed, the initial content of the main window menu bar and toolbar, whether a status line should be displayed, and so forth.

© Copyright International Business Machines Corporation, 2003, 2004, 2006. All Rights Reserved.
Code or samples provided herein are provided without warranty of any kind.