其他 Windchill 功能 > 制造过程管理 > 自定义产品结构浏览器 (PSE) > 自定义 PSE 菜单、工具栏和弹出式菜单
  
自定义 PSE 菜单、工具栏和弹出式菜单
目标
您要更改 PSE 菜单、工具栏或弹出式菜单的内容。
背景
PSE 菜单、工具栏和弹出式菜单的定义相互关联。显示在工具栏和弹出式菜单中的用户界面操作的定义继承自“菜单条”的 ActionAccess 定义。
显示的菜单栏和菜单项不会根据 PSE 的工作模式 (“编辑”、“草稿”或“注释”) 进行更改,但是如果项目与模式不相关,可能会遭到禁用。如同表格中显示的弹出式菜单,工具栏不会根据模式进行更改。仅具有关联图标的菜单项才会显示在工具栏中。
在 PSE 的“任务选项卡”中,已定义了多个具有工具栏和弹出式菜单的表格。它们的实现方式与主菜单栏完全相同 (通过 ActionAccess 定义来实现),但菜单不会显示。
范围/适用性/假设
预期结果
您可能需要针对给定模式更改工具栏内容;例如,您可能需要将“新建查询”图标添加至在主 PSE 窗口中以“草稿模式”显示的工具栏 (“帮助”图标之前),并将“插入现有的”和“插入新的”操作添加至“使用选项卡”弹出式菜单:
解决方法
要将“新建查询”操作添加至工具栏,请在以下位置更改相应的元素:
<Windchill>/codebase/config/logicrepository/xml/explorer/productstructure/
PDMLinkExplorerMenus.xml
要将弹出式菜单条目添加至“使用”选项卡,请在以下位置更改相应的元素:
<Windchill>/codebase/config/logicrepository/xml/explorer/structureexplorer/
ExplorerMenusForUsesTab.xml
必备知识
要实现此目标,您需要了解以下内容:
XML 文件自定义的管理
解决方案元素
元素
类型
说明
PDMLinkExplorerMenus. xml
XML 文件
保留显示在树状结构显示画面中的主 PSE 应用程序菜单、工具栏和弹出式菜单的定义。
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/productstructure
ExplorerMenuIt ems.xml
XML 文件
保留从主应用程序菜单 (PDMLinkExplorerMenus.xml) 和 ExplorerMenus.xml 引用的菜单项定义
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/structureexplorer
ExplorerMenus.x ml
XML 文件
保留从主应用程序菜单 (PDMLinkExplorerMenus.xml) 引用的子菜单的菜单定义
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/structureexplorer
ExplorerMenusF orAttributeTable. xml
XML 文件
保留“信息”选项卡上“属性表”的工具栏和弹出式菜单定义。
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/structureexplorer
ExplorerMenusF orDocumuntsTab .xml
XML 文件
保留“文档”选项卡上表格的工具栏和弹出式菜单定义。
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/structureexplorer
ExplorerMenusF orReplacements Tab.xml
XML 文件
保留“替换部件”选项卡上所有表格的工具栏和弹出式菜单定义。
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/structureexplorer
ExplorerMenusF orUsesTab.xml
XML 文件
保留“使用”选项卡上所有表格的工具栏和弹出式菜单定义。
位于:
<Windchill>/codebase/config/logicrepository/xm
l/explorer/structureexplorer
ActionAccess
XML 元素
保留菜单栏、相关菜单和菜单项的定义。每个 ActionAccess 元素 (即菜单栏定义) 必须包括将用于相关工具栏和弹出式菜单的所有操作。
* 
不支持将新操作添加至菜单栏定义。
包含在 PDMLinkExplorerMenus.xml 和 ExplorerMenus*.xml 中
ModeToolBar
XML 元素
定义特定模式的工具栏。指定 ApplicationMode (通过“导入”) 和 MenuItemIdentifier 列表。
ModePopupMe nu
XML 元素
定义特定模式的弹出式菜单。只需指定模式和 MenuItemIdentifier 列表。
ExplorerMode
XML 元素
ModeToolBar 或 ModePopupMenu 的子元素。指定模式。
MenuItemIdentifi er
XML 元素
ModeToolBar 或 ModePopupMenu 的子元素。标识 (通过 id 参数) 已定义的操作。
步骤 - 自定义工具栏
可以根据给定模式更改工具栏的内容。支持在定义中添加现有项、删除和重新排序项。
请考虑主 PSE 窗口中以“草稿模式”显示的工具栏。举例来说,要将创建“新建查询”的操作添加至工具栏,只需将此条目的 MenuItemIdentifier 插入 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>
这将使得“新建查询”图标显示在工具栏中,如“预期结果”部分所示。
自定义点
自定义弹出式菜单
可以根据给定模式更改弹出式菜单的内容。支持在定义中添加现有操作、删除和重新排序项。
考虑“使用”选项卡。表格的弹出式菜单并非出厂设置;包括“草稿”模式下的“插入现有的”“插入新的”操作。要将这些操作添加至弹出式菜单,只需更改 ExplorerMenusForUsesTab.xml 中的 XML 即可插入 MenuItemIdentifier。
<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>
这将使“替换为全局替换部件/特定替换部件”显示在“使用”选项卡的弹出式菜单中,如预期完成情况所示。
限制
由于 PSE 当前不具有受支持的 API 可供创建自定义操作,因此,针对未定义的操作,不支持将新菜单项添加至菜单、工具栏或弹出式菜单。同样,也不支持将操作添加至未经设计的表格。