You can create your own menu items in PowerDesigner menus by creating an ActiveX add-in.
The ActiveX must implement a specific interface called IPDAddIn to become a PowerDesigner add-in.
This interface defines the following methods:
Those methods are invoked by PowerDesigner in order to dialog with menus and execute the commands defined by the ActiveX.
The Initialize method initializes the communication between PowerDesigner and the ActiveX. PowerDesigner starts the communication by providing the ActiveX with a pointer to its application object. The application object allows you to handle the PowerDesigner environment (output window, active model etc.) and must be saved for later reference. The application object type is defined into the PdCommon type library.
The Uninitialize method is used to clean references to PowerDesigner objects. It is called when PowerDesigner is closed and must be used to release all global variables.
The ProvideMenuItems method returns an XML text that describes the menu items to add into PowerDesigner menus. The method is invoked each time PowerDesigner needs to display a menu.
When you right-click a symbol in a diagram, this method is called twice: once for the object and once for the symbol. Thus, you can create a method that is only called on graphical contextual menus.
The ProvideMenuItems is called once at the initialization of PowerDesigner to fill the Import and Reverse menus. No object is put in parameter in the method at this moment.
The XML text that describes a menu can use the following elements (DTD):
<!ELEMENT Menu (Command | Separator | Popup)*> <!ELEMENT Command> <!ATTLIST Command Name CDATA #REQUIRED Caption CDATA #REQUIRED > <!ELEMENT Separator> <!ELEMENT PopUp (Command | Separator | Popup)*> <!ATTLIST PopUp Caption CDATA #REQUIRED >
Example:
ProvideMenuItems ("Object", pModel)
The following text results:
<MENU> <POPUP Caption="&Perforce"> <COMMAND Name="CheckIn" Caption="Check &In"/> <SEPARATOR/> <COMMAND Name="CheckOut" Caption="Check &Out"/> </POPUP> </MENU>
Note: This syntax is the same used in the creation of a menu using a resource file.
For more information on how to customize menus using a resource file, see Adding Commands and Other Items to Your Menu.