IBM Content Navigator, Version 2.0.3         

Creating a menu action

You can create a plug-in to provide an action to use in IBM® Content Navigator. For example, you might define a custom action that imports documents or that generates a custom report generation for a set of selected documents. This action can be added to toolbars and context menus.

About this task

Procedure

To create an action:

  1. Implement a JavaScript function to define the behavior of the action. For information about actions in IBM Content Navigator, see the ecm.model.Action.js class.
  2. If you want to specify when the action is enabled or disabled, extend the ecm.model.Action.js class.
  3. Extend the PluginAction.java class to define the plug-in for the action:
    1. Implement the getActionFunction method to return name of the JavaScript function that you created in step 1.
    2. If this action overrides the standard code for enabling actions, implement the getActionModelClass method to return name of the JavaScript class that you created in step 2.
  4. Add the action as a component in your Plugin.java subclass. To add the action, implement the getFeatures method to return an instance of the PluginAction.java class that you created in step 3.

Sample plug-in files for a custom menu action

The following files in the sample plug-in define a custom menu action:
Table 1. Sample files that define a plug-in menu action
File Description
SamplePluginAction.java This file extends the PluginAction.java class to define a sample action.

The behavior of this action is defined by the samplePluginAction function that is defined in the SamplePlugin.js file.

SamplePluginCheckInAction.java This file extends the PluginAction.java class to define a sample action.

The behavior of this action is defined by the samplePluginAction function that is defined in the SamplePlugin.js file.

SamplePluginFilteredAction.java This file extends the PluginAction.java class to define a sample action. This class implements an action that is available only for documents with a MIME type of text.

The behavior of this action is defined by the samplePluginFilteredAction function that is defined in the SamplePlugin.js file.

CustomAction.js This file implements the isEnabled function so that an action is enabled only for documents with a MIME type of text.

What to do next

Add the action to a custom toolbar or context menu by implementing the getMenuItems method in a PluginMenu subclass to return an instance of this PluginAction class. This method adds the action to the custom toolbar or menu that is represented by the PluginMenu subclass.

After you add the plug-in in the web client, use the IBM Content Navigator administration tool to add the action to a toolbar or context menu.