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

Chapter 18 showed you how simple it is to create views. To demonstrate just how easy this can be, we have included the view from the chapter discussion in the com.ibm.jdg2e.view.basic project. You may also wish to review these other view-related example plug-ins:

These are located in the com.ibm.jdg2e.view.simplemodel, com.ibm.jdg2e.view.marker, and com.ibm.jdg2e.view.files projects, respectively.

Running the Example

  1. Make sure that dependent plug-in project com.ibm.jdg2e.simplemodel is in your workspace.
  2. Launch and run a runtime workbench (Run > Run As > Eclipse Application) with both this project and the dependent project included in the launch configuration.
  3. Select Window > Show View > Other... and open the JDG2E > Locations (Basic View) view.
    Locations (Basic View)
  4. Explore the view's function and supported actions. As this example was designed as a basic view the function provided is limited; see the other view examples for more information.

Roadmap of the Example

The Basic View plug-in is limited in function by design. It lets you clearly see what is required to create a working view. The view uses as input the location elements obtained from the road trip model provided by the Simple Model (RoadTrip Locations) plug-in, defined in the com.ibm.jdg2e.simplemodel project.

The view has a user interface, actions in the toolbar and pull-down menu, as well as the context menu for the viewer used in the user interface. This is the limit of its function.

The plug-in manifest file defines the extension definition for the Locations (Basic View) and an extension to the Eclipse Resource perspective so the view opens up on top of the Tasks view. The table below shows the key classes from the com.ibm.jdg2e.view.basic package that are used to implement the view part and its associated JFace viewer user interface.

Class (All) Description
BasicViewPart This class implements the view's user interface and function.
LocationsContentProvider Used to obtain model content for the JFace viewer used in the view's user interface.
LocationsTableLabelProvider Used to display content for the ILocation objects shown in the JFace table viewer used in the view.

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