Customize Context Menu (FL_ContextualMenuCusto)

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

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

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

In this section of the context 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 NameTypeRead/WriteComments
GetAttributeObjectMenuCmdListReadTo retrieve the current context menu.
SetAttributeObjectMenuCmdList, MenuList WriteTo update the context menu.

Declare the file containing the script

To customize the context 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 context 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 context menu

The context 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 context menu defined by Functional & Logical Design.

To obtain this default menu content, you must type:

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

In the list of lists, each entry corresponds to a line in the context 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 sub-menu: define a list of at least two strings in the entry.
    • The first string corresponds to the NLS key of the sub-menu entry.
    • The second and more string is the command or separator to be added in the sub-menu.

Sample to Add a New Command

The following script sample explains how to add a new command in the context 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 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.