Customize Shortcut Menu (FL_ContextualMenuCusto)

An opening ID is an entry point used to customize business logic. The FL_ContextualMenuCusto business logic enables you to customize the Shortcut Menu that is displayed on a requirement, function, or logical component.

Note: For more information about customization by business rules, see Customization by Business Rules.

This page discusses:

General Information

This opening ID is used to customize the section of the Shortcut Menu that contains app-specific commands (that is, the commands managing functional and logical objects).

In this section of the Shortcut Menu, you can:

  • Remove commands
  • Add commands
  • Reorder commands
  • Create one or more submenus (one level)
  • Create a separator (a line to separate commands).

The table below provides you with information related to the definition of the opening ID.

PLM Opening ID: FL_ContextualMenuCusto
Customization intent: Computation
Execution context: Client

Input Objects

Input objects must be of the following types:

  • ThisObject
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter Name Type Read/Write Comments
GetAttributeObject MenuCmdList Read To retrieve the current shortcut menu.
SetAttributeObject MenuCmdList, MenuList Write To update the shortcut menu.

Declare the File Containing the Script

To customize the Shortcut Menu, you must declare the file containing the script to be executed in PLMBusinessLogicFLEditor.CATRuleExit:

In this example, the script RFLP_CxtMenuCusto_FctInstance is executed each time a Shortcut Menu is requested on an object type RFLPLMFunctionalInstance.

The string Type can be defined with:

  • a modeler type (RFLPLMFunctionalInstance, RFLPLMFunctionalReference…)
  • a customized type (RFLPLMFunctionalInstanceDS, RFLPLMFunctionalReferenceDS)

Create a Script for the Customized Shortcut Menu

The Shortcut Menu is described in a new script, in a Parameters section, through a list of lists (containing strings).

The attribute "MenuCmdList" is assigned to this list of lists.

Example: To create a list of lists called MenuList, the Parameters section must contain the following line.

Parameters->SetAttributeObject("MenuCmdList", MenuList)

By default, the attribute "MenuCmdList" declared in the Parameters section applies the default Shortcut Menu defined by Functional & Logical Design.

To obtain this default menu content, you must enter:

let MenuList (List)
set MenuList = Parameters->GetAttributeObject ("MenuCmdList")

In the list of lists, each entry corresponds to a line in the Shortcut Menu:

  • To display a command or a separator: define one string in the entry.

    The string is the command header name or the "SEPARATOR" keyword for a separator.

  • To display a submenu: define a list of at least two strings in the entry.
    • The first string corresponds to the NLS key of the submenu entry.
    • The second and more string is the command or separator to be added in the submenu.

Sample to Add a New Command

The following script sample explains how to add a new command in the Shortcut Menu.

let MenuList(List)
let CurrentMenuItem(List)
let CurrentCommand(String)
set MenuList = Parameters->GetAttributeObject ("MenuCmdList")
CurrentCommand = "SEPARATOR"
CurrentMenuItem.RemoveAll()
CurrentMenuItem.Append(CurrentCommand)
MenuList.Append(CurrentMenuItem)
CurrentCommand = "CATRFLPLMPropagateToEditionCmdHdr"
CurrentMenuItem.RemoveAll()
CurrentMenuItem.Append(CurrentCommand)
MenuList.Append(CurrentMenuItem)
CurrentCommand = "CATRFLPLMPropagateToReadOnlyCmdHdr"
CurrentMenuItem.RemoveAll()
CurrentMenuItem.Append(CurrentCommand)
MenuList.Append(CurrentMenuItem)
Parameters->SetAttributeObject("MenuCmdList", MenuList)

Sample to Remove Standard New Commands

The following sample explains how to add a new command in the Shortcut 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 Shortcut 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 define the NLS value of the submenu entry in the resources\msgcatalog\CATPLMEditorWorkbench.CATNls file:

EditabilitySubMenu.Title = "Editability..."

Sample to Apply Different Scripts on Different Customized Types

To apply different Shortcut Menus on different customized types, there are two methods:

  • Test the customized type inside a single script (that is CATRule file) with IsASortOf method:
    if (ThisObject->IsASortOf ("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 is executed to build the Shortcut Menu on an instance of RFLPLMFunctionalInstanceCusto1 customized type.

    The script in the RFLP_CtxtMenuCusto_FctInstanceCusto2.CATRule file is executed to build the Shortcut Menu on an instance of RFLPLMFunctionalInstanceCusto2 customized type.