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

In Chapter 18, Views, you learned how to create views and that a view could be used to display anything you wanted. The example provided in the com.ibm.jdg2e.view.marker project shows how markers can be displayed in a view.

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.basic, and com.ibm.jdg2e.view.files projects, respectively.

Running the Example

The view displays a specific type of marker (com.ibm.jdg2e.resources.extensions.recentEdits), also known as Recent Edit markers. These markers are created by the function provided by the Resource Extensions plug-in, located in the project com.ibm.jdg2e.resources.extensions. The function provided there uses a resource change listener to identify when files have been modified, when such a change is detected a Recent Edit marker is created. This process is controlled by a preference page and customized by a property page. See the combined Resource Extensions documentation for the marker details.
  1. Launch and run a runtime workbench (Run > Run As > Eclipse Application) with both the com.ibm.jdg2e.view.marker and com.ibm.jdg2e.resources.extensions projects available.
  2. Find and open the JDG2E > Recent Edit Markers view.
    action
  3. If no markers are visible you will need to trigger the creation of one by editing and saving a file.
  4. Select a marker in the view and review the context menu, when done press F1 to display marker specific help content. One of the available actions and the marker specific help was contributed by the Resource Extensions plug-in.

Roadmap of the Example

The Marker View plug-in only differs from the Basic View example in these areas:

The plug-in manifest file defines the extension definition for the Recent Edits Marker view and an extension to the Eclipse Resource perspective to have the view opened up on top of the Tasks view. The table below shows the key classes from the com.ibm.jdg2e.view.marker package that are used to implement the view part and its associated JFace viewer user interface.

Class (All) Description
MarkerView This class implements the view's user interface and function.
MarkerContentProvider Used to obtain recent edit markers from the workspace for display in the viewer. The resource change listener logic only refreshes the viewer when a Recent Edit marker change has been reported in the resource delta.
MarkerLabelProvider Used to display content for the IMarker 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.