miercuri, 3 decembrie 2008

Adding Items to the AOT Add-Ins Menu

Adding Items to the AOT Add-Ins Menu

 


 

Collapse All Expand All

The shortcut menu in the Application Object Tree (AOT) has an Add-ins menu where you can find various development tools such as the cross-reference system and the Visual MorphXplorer.

To add your own tool to the Add-ins submenu

  1. Create a menu item for the tool.
  2. Locate the item you want to add to the Menu
    Items node.
  3. Drag the menu item onto sysContextMenu in the Menus node.

Enabling and Disabling Menu Items According to Context

All items in the sysContextMenu menu are automatically added to the Add-ins submenu. If you want to disable items according to the current context, you need to add to the verifyItem method for the SysContextMenu class.

verifyItem( identifiername
MenuItemName , MenuItemType
MenuItemType ) is automatically called for each item you add to the sysContextMenu menu. It takes the name of the menu item and the menu item type as parameters, and must return 0 (zero) if the item isn't available.

Example

The following extract from verifyItem shows the testing performed when the parameter is the menu item MorphXplorer.

Copy Code

case menuItemDisplayStr(MorphXplorer):

if (this.selectionCount() != 1 ||

firstNode.AOTIsOld() //Does not work for old nodes

)

{

return 0;

}

if (!docNode &&

(_firstType==UtilElementType::Class ||

_firstType==UtilElementType::Table))

{

return 1;

}

return 0;

Tip

There are other classes called SysContextMenu*, for example, SysContextMenuCompare. These classes are used when there are several levels in the add-ins hierarchy. For example, when you activate Compare on two objects, the Add-ins submenu is also available in the Compare dialog. The first() and next() methods on sysContextMenuCompare define the proper context.

 

Niciun comentariu: