Sample to Remove Standard New Commands
The following sample explains how to add a new command in the context menu.
let MenuList(List)
let CurrentMenuItem(List)
let ItemSize(Integer)
let CurrentCommand(String)
let i(Integer)
set MenuList = Parameters->GetAttributeObject ("MenuCmdList")
i=MenuList.Size()
for i while i>0
{
set CurrentMenuItem = MenuList.GetItem(i)
set ItemSize = CurrentMenuItem.Size()
if (ItemSize == 1)
{
set CurrentCommand = CurrentMenuItem.GetItem(1)
if (CurrentCommand == "CATPLMEditorInsertNewReferenceCmdHdr")
{
MenuList.RemoveItem(i)
}
else if (CurrentCommand == "CATPLMEditorInsertExistingReferenceCmdHdr")
{
MenuList.RemoveItem(i)
}
else if (CurrentCommand == "CATPLMEditorInsertNewFunPortCmdHdr")
{
MenuList.RemoveItem(i)
}
else if (CurrentCommand == "CATPLMEditorInsertNewFunConnectionCmdHdr")
{
MenuList.RemoveItem(i)
}
}
i = i-1
}
Parameters->SetAttributeObject("MenuCmdList", MenuList)
Sample to Create Submenus
The following sample explains how to create submenus in the context menu.
let MenuList(List)
let CurrentCommand(String)
let FLEditabilitySubMenu(List)
set MenuList = Parameters->GetAttributeObject ("MenuCmdList")
CurrentCommand = "EditabilitySubMenu"
FLEditabilitySubMenu.Append(CurrentCommand)
CurrentCommand = "CATRFLPLMPropagateToEditionCmdHdr"
FLEditabilitySubMenu.Append(CurrentCommand)
CurrentCommand = "CATRFLPLMPropagateToReadOnlyCmdHdr"
FLEditabilitySubMenu.Append(CurrentCommand)
MenuList.Append(FLEditabilitySubMenu)
Parameters->SetAttributeObject("MenuCmdList", MenuList)
The EditabilitySubMenu
keyword is used to defined the NLS value of the sub-menu entry in the resources\msgcatalog\CATPLMEditorWorkbench.CATNls file:
EditabilitySubMenu.Title = "Editability..."
Sample to Apply Different Scripts on Different Customized Types
To apply different context menus on different customized types, there are two methods:
- Test the customized type inside a single script (i.e. CATRule file) with
IsSupporting
method:if (ThisObject->IsSupportiing ("RFLPLMFunctionalReferenceCusto1) = true)
{
[...]
}
- In the PLMBusinessLogicFLEditor.CATRuleExit file, specify different scripts for the different customized types:
<Script OpeningID="FL_ContextualMenuCusto" Type="RFLPLMFunctionalInstanceCusto1"
ScriptName="RFLP_CtxtMenuCusto_FctInstanceCusto1" />
<Script OpeningID="FL_ContextualMenuCusto" Type="RFLPLMFunctionalInstanceCusto2"
ScriptName="RFLP_CtxtMenuCusto_FctInstanceCusto2" />
The script in the RFLP_CtxtMenuCusto_FctInstanceCusto1.CATRule
file will be executed to build the context menu on an instance of RFLPLMFunctionalInstanceCusto1
customized type.
The script in RFLP_CtxtMenuCusto_FctInstanceCusto2.CATRule
file will be executed to build the context menu on an instance of RFLPLMFunctionalInstanceCusto2
customized type.