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

In Chapter 15, JFace Viewers, and Chapter 18, Views, we needed a model to demonstrate our example user interface. Instead of using the workspace we chose to use a simple model called "road trip." The IRoadTrip implementation has ILocations with several attributes. These interfaces, along with an adapter factory based implementation of IPropertySource and IWorkbenchAdapter, are defined in the com.ibm.jdg2e.simplemodel project.

Running the Example

There is no example to run for this project, the model is used in the viewer and view examples.

Roadmap of the Example

The Simple Model (RoadTrip Locations) plug-in is limited in function by design. It provides access to a simple model with default content. If required this default content can be used to refresh the content of the active model. The model accepts adds, updates, and deletes and uses a property change mechanism to notify listeners of changes to model content. A simple serialization technique is used to persist the model content to the plug-in's state directory.

There is some user interface support provided by this plug-in. Both the contents of the Properties view and partial support for the Properties dialog are provided through the extensions to the Eclipse adapter framework that are defined and implemented in this plug-in.

Simple Model Implementation

The plug-in class provides access to the model content and persists the model when the Eclipse platform is shut down. In addition there are adapter definitions in the plug-in manifest file that identify where the IPropertySource and IWorkbenchAdapter adapters are implemented. The table below shows the key classes from the com.ibm.jdg2e.simplemodel package that are used to implement the model and its adapters.

Class (All) Description
SimpleModel The plug-in class that provides model access and implements model persistence.
LocationAdapterFactory Implementation of the org.eclipse.core.runtime.adapters extension; provides access to the supported adapters.
LocationPropertySource Adapter that supports the display of model content in the Properties view.
LocationWorkbenchAdapter Adapter that supports the display of model content in the Properties dialog.
Simple Model API Interfaces that describe the behavior of the simple model.
Simple Model Implementation Classes that implement the behavior of the simple model.

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