IDE Menu Plug-Ins

Menu plug-ins are components that the Uniface IDE calls to dynamically add custom menu items to the IDE's Main Menu ( ≡ ) and to the Actions menu of editors. They let you integrate functionality that is specific to your environment or workflow into the IDE.

For example, you can add menu items that call components to:

  • Rename objects and references in code
  • Compile all components that use an entity after it has been modified
  • Integrate with your version control system
  • Create logs of changed objects for your build environment, and so on.

Menu plug-ins make use of the Menu Plug-In API, which describes plug-in operations that define the menu options to be added to the IDE menus, and callback operations that implement the actions to be performed. You can implement these operations in your own components and add them to the IDE resources, so that the IDE can:

  • Dynamically add menu options to its menus.
  • Activate the specified menu callback operations.
  • Refresh editors or give focus to a particular editor when the callback operation completes.

For more information, see Menu Plug-In Operations and Menu Callback Operations.

At runtime, when you click the main menu or Actions menu, the IDE calls the components that implement the plug-in operations, and adds the returned menu options to the menu, always preceded by a separator.

Because the IDE calls these operations when you click a menu, not when it is first started, the menu options for the Actions menu can be suited to the current editor and object.

Note: It is not possible to add menu options to the More Editors menu, or any of the editors in this menu.

Example: Adding your own menu items to the Uniface IDE

For example, assume you want to add the following menu options:

  • System Info to the main menu.
  • Test with Debug to the Actions menu in the Component Editor.
  • Start Application to the Actions menu in the Application Shell Editor.
  • Show Statistics for ObjectName to the Actions menu in all editors.

You create two menu plug-in components, CUSTOM_MENU1 and CUSTOM_MENU2, which implement the plug-in operations and generate the needed menu items. And you create three callback components to perform the desired actions. When clicked, the menu items activate operations in the callback components, as shown in the following illustration.

The IDE has to know the names of the menu plug-in components and where to find them, so you need to edit IDE assignment file (ide.asn).

Specify the menu plug-in components with the logical IDE_DEFINE_USERMENUS:

[LOGICALS]
IDE_DEFINE_USERMENUS=CUSTOM_MENU1,CUSTOM_MENU2

Add both the plug-in and callback components to the Uniface resources by listing them in the [RESOURCES] section of ide.asn file. For example, you could package them in a dedicated Uniface archive file (menuplugin.uar), which is specified in ide.asn:

[RESOURCES]
menuplugin.uar
usys:ide.uar
usys:ide_messages.uar

At runtime, the resulting options are added to the Uniface IDE menus. Separators demarcate the user-defined menu section. For example:

Main Menu with Plug-In Menu Option

Editor Actions Menu with Plug-In Menu Options

Related Topics