Sunday, May 4, 2008

Adding Items to the AOT Add-Ins Menu

Adding Items to the AOT Add-Ins Menu

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

Create a menu item for the tool.

Locate the item you want to add to the Menu Items node.

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.


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.

ANTIQR26
By: Favoshots
Views: 0
ANTIQR27
By: Favoshots
Views: 0
ANTIQR29
By: Favoshots
Views: 0
ANTIQR31
By: Favoshots
Views: 0
ANTIQR32
By: Favoshots
Views: 0
ANTIQR33
By: Favoshots
Views: 0
ANTIQR34
By: Favoshots
Views: 0
ANTIQR37
By: Favoshots
Views: 1
ANTIQR38
By: Favoshots
Views: 1
ANTIQR40
By: Favoshots
Views: 1
ANTIQR41
By: Favoshots
Views: 1
ANTIQRA
By: Favoshots
Views: 1
ANTIQRA2
By: Favoshots
Views: 1
ANTIQRA3
By: Favoshots
Views: 1
ANTIQRA4
By: Favoshots
Views: 1
ANTIQRA5
By: Favoshots
Views: 1