You can create a plug-in to provide a custom toolbar or
context menu to use in IBM Content Navigator.
About this task
To create a menu, you must first create the menu type. The
menu type indicates where and how the menu will appear in the user
interface. For example, you might define a menu type to create a context
menu for a custom widget. You can use the menu type for multiple menus.
Procedure
To create a custom menu:
- Extend the PluginMenuType.java class
to define the menu type:
If the menu is a toolbar, implement
the isToolbar method to return true.
If you do not implement this method or if the method returns false,
the menu is a context menu.
For a default menu, the menu type
provides an identifier for the default menu. When a user creates a
copy of this menu, the menu type is identified in the copy to link
it back to the original menu.
- Extend the PluginMenu.java class
to define the menu:
- Implement the getId method to return
the identifier for the menu.
Prefix the identifier with
"Default" if users will be able to create copies of this menu.
- Implement the getMenuType method
to return the PluginMenuType class that you created
in step 1.
- Implement the getMenuItems method
to return instances of the actions that are included in the menu.
- Add the menu as a component in your Plugin.java subclass:
- Implement the getMenuTypes method
to return an instance of the PluginMenuType.java subclass
that you created in step 1.
- Implement the getMenus method to
return an instance of the PluginMenu.java subclass
that you created in step 2.
Sample plug-in files for a custom menu
The
following files in the sample plug-in define a context menu and two
toolbar menus:
Table 1. Sample files
that define a plug-in menu
| File |
Description |
| SamplePluginContextMenuMenuType.java |
This file extends the PluginMenuType.java class
to create a menu type for a context menu. |
| SamplePluginContextMenuMenu.java |
This file extends the PluginMenu.java class
to defines a context menu that includes the following actions:
- A sample action, which is defined in the SamplePluginAction.java file
- Properties
- Help
- About
- Preview
- Open
The following actions are in the available actions box:
- Custom Checkin
- Only For Text Docs
|
| SamplePluginToolbarMenuType.java |
This file extends the PluginMenuType.java class
to create a menu type for a toolbar. |
| SamplePluginToolbarMenu.java |
This file extends the PluginMenu.java class
to defines a toolbar that includes the following actions:
- A sample action, which is defined in SamplePluginAction.java file
- Help
- About
|
| SamplePluginToolbarMenuType2.java |
This file extends the PluginMenuType.java class
to create a menu type for a toolbar. |
| SamplePluginToolbarMenu2.java |
This file extends the PluginMenu.java class
to defines a toolbar that includes the following actions:
- A sample action, which is defined in the SamplePluginAction.java file
- Custom Checkin, which is defined in the SamplePluginCheckInAction.java file
- Help
|
What to do next
After you add the plug-in in the web client, use the IBM Content Navigator administration tool
to add the menu to a desktop.