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

This example plug-in is discussed in Chapter 21, Action Contributions: The Integration Fast Track. Also see project com.ibm.jdg2e.actions that contains examples that are not dependent on the Eclipse IDE. It is helpful to have these projects installed and available in your Eclipse workspace when you read this chapter. To study these examples you will need to examine both the Java code and the plug-in manifest file.

Running the Example

To run this example, install the project com.ibm.jdg2e.actions.ide in your workspace and launch the run-time instance of Eclipse (Run > Run As > Eclipse Application).

There are three actions available. Depending on the specific action, they may appear in the Workbench menu bar or toolbar, a view's menu or toolbar, or as a context menu (pop-up menu) in a view or editor. Here are the instructions for running each action.

  1. Close Unmodified Files Action
    This action closes all editors for files that have no modifications to be saved. It is available from the Workbench File pulldown menu, a context menu in the Navigator view, or by entering the key combination: Shift + F4.

    Close Unmodified Files Action (File menu)

    Close Unmodified Files Action (View's menu)

  2. Show Modified Action
    This action filters the Navigator view to show only modified files, their parent folders, and hosting project. The action is available on the view toolbar and menu. It is a toggle type action. When toggled off the Navigator view shows all workspace content.

    Show Modified Action

  3. Text Editor Wordcount Action
    This editor action counts the words in the selected text of a text editor and displays the result in a simple dialog. It appears on the Workbench toolbar () or in the context menu of the active text editor when text is selected (see figures below). It is enabled when you select text. The context menu label is: JDG2E: Word Count.

    Word Count Action

Roadmap of the Example

See Chapter 21 which discusses these examples in detail.

The table below lists the action classes, class descriptions, and links to the Javadoc.

Class (all) Description
CloseUnmodifiedViewAction Navigator view action to close unmodified editors.
CloseUnmodifiedWorkbenchAction Workbench menu action to close unmodified editors.
ShowModifiedAction Show only modified files in the Navigator view.
TextEditorWordCountAction Text editor action.

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