Customizing PSE Menus, Toolbars and Popup Menus
Objective
You want to change the content of a PSE menu, toolbar or popup menu.
Background
The definition of the PSE Menus, Toolbars and popup menus are interconnected. The definition of the user interface actions that appear in the toolbars and popup menus is inherited from the ActionAccess definition of the Menu Bar.
The Menu Bar and Menu Items that are displayed do not change based on the mode (“edit”, “draft” or “annotate”) in which PSE is working, though items may become disabled if they are not relevant for the mode. The Toolbar does change based on the mode, as do the popup menus exposed in the tables. Only menu items that have an icon associated can appear in a toolbar.
In the Task Tabs of PSE, a number of tables are defined, which have tool bars and popup menus. These are implemented in the exact same way as the main menu bar via ActionAccess definitions, but the menus are not displayed.
Scope/Applicability/Assumptions
Intended Outcome
You may want to change the content of the toolbar for a given mode; for example you may want to add the “New Query” Icon to the toolbar (before the Help icon) that is displayed in Draft Mode for the main PSE window, and also to add the actions “Insert Existing” and “Insert New” to the Uses Tab popup menu:
Solution
To add the New Query Action to the Toolbar change the appropriate element in:
<Windchill>/codebase/config/logicrepository/xml/explorer/productstructure/
PDMLinkExplorerMenus.xml
To add the popup menu entries to the Uses tab change the appropriate element in:
<Windchill>/codebase/config/logicrepository/xml/explorer/structureexplorer/
ExplorerMenusForUsesTab.xml
Prerequisite knowledge
To achieve this objective, you need to have an understanding of the following:
• Management of XML file customizations
Solution Elements
Element | Type | Description |
PDMLinkExplorerMenus. xml | XML file | Holds the definition of the main PSE Application Menus, toolbars and popup menus that appear in the tree displays. Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/productstructure |
ExplorerMenuIt ems.xml | XML file | Holds Menu Item definitions, referenced from the main application menu (PDMLinkExplorerMenus.xml) and ExplorerMenus.xml Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/structureexplorer |
ExplorerMenus.x ml | XML file | Holds Menu definitions for sub-menus referenced from the main application menu (PDMLinkExplorerMenus.xml) Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/structureexplorer |
ExplorerMenusF orAttributeTable. xml | XML file | Holds the definition of the toolbars and popup menus for the Attribute Table on the Information Tab. Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/structureexplorer |
ExplorerMenusF orDocumuntsTab .xml | XML file | Holds the definition of the toolbars and popup menus for the tables on the Documents Tab. Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/structureexplorer |
ExplorerMenusF orReplacements Tab.xml | XML file | Holds the definition of the toolbars and popup menus for all tables on the Replacements Tab. Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/structureexplorer |
ExplorerMenusF orUsesTab.xml | XML file | Holds the definition of the toolbars and popup menus for all tables on the Uses Tab. Located in: <Windchill>/codebase/config/logicrepository/xm l/explorer/structureexplorer |
ActionAccess | XML element | Holds the definition of a MenuBar, related Menus and MenuItems. Each ActionAccess element (i.e., MenuBar definition) must include all the actions that will be used in the related Toolbars and Popup Menus. | Adding new actions to the MenuBar definition is not supported. |
Contained in PDMLinkExplorerMenus.xml and ExplorerMenus*.xml |
ModeToolBar | XML element | Defines a toolbar for a specific mode. Specifies the ApplicationMode (via an Import) and a list of MenuItemIdentifiers. |
ModePopupMe nu | XML element | Defines a popup menu for a specific mode. Simply specifies the mode and a list of MenuItemIdentifiers. |
ExplorerMode | XML element | Sub-element of ModeToolBar or ModePopupMenu. Specifies the mode. |
MenuItemIdentifi er | XML element | Sub-element of ModeToolBar or ModePopupMenu. Identifies (through the id parameter) a defined Action. |
Procedure — Customizing the Toolbar
It is possible to change the content of the Toolbar for a given mode. Adding existing, deleting and re-ordering the items in the definitions are supported.
Consider the Toolbar that is displayed in Draft Mode for the main PSE window. For the example of adding the action to create a “New Query” to the toolbar, simply insert the MenuItemIdentifier for that entry into the XML
<ModeToolBar id="ToolBarB">
<Import id="ptc.wnc.exp.DraftAppMode"/>
<MenuItemIdentifier id="FileNewPartMI"/>
<MenuItemIdentifier id="FileOpenPartMI"/>
<Separator/>
<MenuItemIdentifier id="FileSaveChangesMI"/>
<MenuItemIdentifier id="FileAnnotationValidationMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.CloseMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.LaunchNewPSEMI"/>
<MenuItemIdentifier id="SetConfigSpecMI"/>
<Separator/>
<MenuItemIdentifier id="ptc.wnc.exp.InfoPageMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.CutMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.CopyMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.PasteMI"/>
<Separator/>
<MenuItemIdentifier id="ptc.wnc.exp.CopyToWindchillClipboardMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.CopyFromWindchillClipboardMI"/>
<Separator/>
<MenuItemIdentifier id="SelectedAddChildMI"/>
<MenuItemIdentifier id="SelectedAddNewChildMI"/>
<MenuItemIdentifier id="SelectedAddInsertNewMI"/>
<Separator/>
<MenuItemIdentifier id="SelectedReplaceExistingMI"/>
<MenuItemIdentifier id="SelectedReplaceCreateAndReplaceMI"/>
<MenuItemIdentifier id="SelectedReplaceNewMI"/>
<MenuItemIdentifier id="SelectedReplaceAlternateMI"/>
<Separator/>
<MenuItemIdentifier id="FileSpecEditorLaunchMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.ReviseMI"/>
<MenuItemIdentifier id="SelectedRemoveMI"/>
<Separator/>
<MenuItemIdentifier id="ptc.wnc.exp.SelectParentMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.ExpandAllMI"/>
<Separator/>
<MenuItemIdentifier id="EditEditModeMI"/>
<Separator/>
<MenuItemIdentifier id="ptc.wnc.exp.FindInStructureMI"/>
<MenuItemIdentifier id="NewQueryMI"/>
<Separator/>
<MenuItemIdentifier id="HelpTopicsMI"/>
</ModeToolBar>
This results in the New Query icon appearing in the toolbar as shown in Section Intended Outcome.
Customization Points
Customizing a Popup Menu
It is possible to change the content of a Popup Menu for a given mode. Adding existing actions, deleting and re-ordering the items in the definitions are supported.
Consider the Uses tab. The popup menu for the table does not, out-of-the-box; include the actions Insert Existing and Insert New in Draft mode. To add these to the popup menu, simply change the XML in ExplorerMenusForUsesTab.xml such that these MenuItemIdentifier is inserted.
<ModePopupMenu id="PopupMenuB">
<Import id="ptc.wnc.exp.DraftAppMode"/>
<Import id="ptc.wnc.exp.AnnotateAppMode"/>
<MenuItemIdentifier id="ptc.wnc.exp.CutAssocMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.CopyAssocMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.PasteAssocMI"/>
<Separator/>
<MenuItemIdentifier id="AddChildMI"/>
<MenuItemIdentifier id="NewChildMI"/>
<Separator/>
<MenuItemIdentifier id="ReplaceExistingMI"/>
<MenuItemIdentifier id="CreateAndReplaceMI"/>
<MenuItemIdentifier id="ReplaceNewMI"/>
<MenuItemIdentifier id="ReplaceAlternateMI"/>
<Separator/>
<MenuItemIdentifier id="ptc.wnc.exp.RevertAssocMI"/>
<MenuItemIdentifier id="ptc.wnc.exp.CommentAssocMI"/>
</ModePopupMenu>
The results in the “Replace with Alternate/Substitute” appearing in the popup in the Uses Tab as shown in the Intended Outcome.
Limitations
Adding new MenuItems to Menus, Toolbar or Popup menus for actions that are not defined is not supported, as PSE currently has no supported API to allow custom actions to be created. Also adding actions to tables for which they are not designed is not supported.