Function to Customize Context Menus
You can define customized context menu entries in ADE Verifier by including any of the following variables in the verifier.menus file.
-
verifImpContextMenu -
verifReqContextMenu -
verifRunContextMenu -
verifResultsMenu
By using any of these environment variables, you can create custom context menus in the Implementations or Requirements panes of the Setup tab or in the Run and Results tabs. The definitions are added at the end of the respective context menu. For more information, see Function to Customize Menu Banners. You define these variables as a list of items that can be another list, a symbol, or a string in the following format:
(id text tooltip entry [enabled-fn] [show-fn])
Here,
-
id is the symbol identifier,
-
text denotes <menu text> with its corresponding <tooltip>,
-
entry is either a string with a SKILL callback, a symbol with the name of a function, or a list defining a sub-menu.
-
enabled-fn and shown-fn are optional callbacks that specify if the items should be enabled and shown.
For example, you can place the following code in work Or ProjectArea/menus/verifier.menus and launch Verifier in a new Virtuoso session. You then find the new menu actions added to the context menus.
; The menu entry is a list of items that is a list, a string, or a symbol. ; ; If it is a string, a separator is placed at the menu entry location, and the ; contents of the string are ignored. ; ; If it is a symbol, then the menu entry is a reference to an existing menu entry/ ; definition that can be defined elsewhere(for example, as myAbc and mySlider). ; ; If it is a list, then a menu action is created using the contained definition, ; which needs to be in the following format: ; ; (id menu-name menu-tooltip menu-entry menu-tooltip [menu-enabled-fn] ; [menu-item-shown-fn]). ; ; menu-name is the text that is displayed in the menu, and menu-tooltip is its ; corresponding tooltip. ; ; The menu-entry can be one of the following: ; a) a string: It is evaluated as a callback and no arguments are passed on ; to the callback. ; b) a symbol: It is the name of a callable object (i.e. function-name or ; lambda function) which takes two arguments - session, and selected. ; c) a list: It defines the contents of a pull-right menu. ; ; The menu-enabled-fn is either nil, a string or a callable function which if ; non-nil, is evaluated to determine if the menu is enabled or not. ; ; The menu-item-shown-fn is either nil, a string or a callable function. If it is ; non-nil, it is evaluated to determine if the menu items are shown in the context ; menu or not. For example, you can use it to only show an item if there is at ; least one item selected, or only show an entry if a single implementation is ; selected . ; ; If the menu or the enabled callback function are not defined, or if the enabled ; function returns an error, then the menu is disabled. ; ; The menu-callback, enable-callback, and show-callback functions should take the ; following two arguments: a session-number + list-of-selected-items. ; info("Loading custom menus...\n")
custom1 = '(custom1 "My Impl 1" "Custom 1 Tooltip" doImpl1CB1)
;; Defines the custom context menu for the Implementations pane in the Setup tab.
verifImpContextMenu =
'(
custom1 (custom2 "My Impl 2" "Do more custom stuff" "doImplCB2()" doImplCB2Enabled isCustom2Shown) "----" ; separator (slider1 "Slider" "Slide right for extra stuff" ( (item1 "Item1" "Item1 Tooltip" doImplCB1 item1Enabled) ) isSlider1Enabled ) slider2 )
|
slider2 = '(slider2 "Slider 2" "Yet another Slider" ((item3 "Item3" "Item3 Tooltip" doImplCB1)) nil showSlider2)
;; Defines the custom context menu for the Requirements pane in the Setup tab.
verifReqContextMenu =
'(
(req1 "My Req Item" "Do req stuff" doReqCB doReqEnabled isReqShown) )
;; Defines the custom context menu for the run table in the Run tab.
verifRunContextMenu =
'(
(run1 "My Run Item" "Do run stuff" doRunCB doRunEnabled isRunShown) )
;; Defines the custom context menu for the results table in the Results tab.
verifResultsContextMenu =
'(
(res1 "My Res Item 1" "Do res stuff" doResCB doResEnabled isResShown) )
info("...finished loading custom menus.\n")
|
Any callback takes two arguments: (session-number list-of-selected-names).
The following section describes the various callback functions:
; Defines all the various callbacks for the custom menus in the Requirement, Run ; and Results hierarchies defun( doImplCB1 (sess sel) info("doImplCB1 CB session: %L selected set: %L\n" sess sel) ) defun( doImplCB2 () info("doImplCB2 CB called with no arguments") ) defun( doImplCB2Enabled (sess sel) ;; custom2 is enabled only if more than 2 items are selected. length(sel)>2 ) defun( isImpl2Shown (sess sel) ;; customer2 is shown only if more than 1 item is selected. length(sel)>1 ) defun( item1Enabled (sess sel) length(sel)>2 ) defun( isSlider1Enabled (sess sel) ;; slider1 is always enabled. t ) defun( showSlider2 (sess sel) ;; slider2 is visible only if more than 3 items are selected. length(sel)>3 )
defun( doReqCB (sess sel)
info("Req CB session: %L selected set: %L\n" sess sel) ) defun( doRunCB (sess sel) info("Run CB session: %L selected set: %L\n" sess sel) ) defun( doResCB (sess sel) info("Res CB session: %L selected set: %L\n" sess sel) ) defun(doReqEnabled (sess sel) info("Req Enabled session: %L selected set: %L\n" sess sel) t ) defun(doRunEnabled (sess sel) info("Run Enabled session: %L selected set: %L\n" sess sel) t ) defun(doResEnabled (sess sel) info("Res Enabled session: %L selected set: %L\n" sess sel) t ) defun(isReqShown (sess sel) info("Is Req shown session: %L selected set: %L\n" sess sel) t ) defun(isRunShown (sess sel) info("Is Run shown session: %L selected set: %L\n" sess sel) t ) defun(isResShown (sess sel) info("Is Res shown session: %L selected set: %L\n" sess sel) t )
|
Return to top