This documentation supports the `com.ibm.lab.soln.contributions` solution. You should have this solution installed and available in your Eclipse workspace when you read this information.

## Running the Solution

To run the example, launch the run-time instance of Eclipse (Run > Run As > Run-time Workbench).
There are four 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. Activate Editors
   A contribution to a toolbar pull-down menu is defined whose contents are based on the open workbench editors. When there are open editors, this should be visible on the toolbar as a pull-down menu like the figure below. If it is not visible, either reset the current perspective using Window > Reset Perspective or activate the action using Window > Customize Perspective > Other and select Soln: Contributions.
2. View Actions
   An action contribution is defined for the Navigator view and the Package Explorer view that will collapse the expanded nodes of their tree viewer. It appears in the view's menu and toolbar (a similar function is provided in Eclipse 2.1).
3. Editor Actions
   An editor action is defined that 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). The context menu label is: Soln: Word Count.
4. Object Contribution Action
   This action is available on file resources that are not in-sync with the local file system; a little smarter version of the standard Refresh action. It appears as a context menu with the label Soln: Smart Refresh on a file selected in the Navigator view or the Package Explorer view. The action is enabled only if the the file has been updated outside the Workbench. This action requires that the extension point org.eclipse.ui.startup is defined in the plug-in manifest. The supplied plugin.xml file defines this extension point but it is commented out. In the plug-in manifest replace this line:
   <!-- <extension point="org.eclipse.ui.startup"/> -->
   with this line:
   <extension point="org.eclipse.ui.startup"/>

## Roadmap of the Solution

See Exercise 6, Contributions Revisited, which discusses this solution in detail.

The table below lists the solution classes, provides descriptions, and links to the Javadoc.

Class (All) | Description
ActivateEditorPulldownDelegate | A contribution to a toolbar pull-down menu is defined whose contents are based on the open Workbench editors.
PackageExplorerCollapseNodesAction | Returns this view's TreeViewer which is required by the parent abstract class TreeViewerCollapseNodesAction.
ResourceNavigatorCollapseNodesAction | Returns this view's TreeViewer which is required by the parent abstract class TreeViewerCollapseNodesAction.
SmartRefreshAction | Provides a refresh of a workspace file only if the selected file is not in-sync with the local file system.
TextEditorWordCountAction | The action counts the words in the selected text of the text editor.
TreeViewerCollapseNodesAction | This action will collapse the selected nodes of the tree viewer provided by its subclass (see PackageExplorerCollapseNodesAction and ResourceNavigatorCollapseNodesAction).

© Copyright International Business Machines Corporation, 2003.
All rights reserved.