Enabled/Visible Condition

Enabled/Visible Conditions are two model classes by which relationships can be linked to element types, actions, properties, tools, or dialog input fields. These conditions determine when the execution of an action or tool is permitted or when an input dialog field is editable, grayed out, hidden or when a property is visible in the Eclipse Property view.

When modeling an enabled condition for an Action_Has_Tool relationship, the administrator defines the permitted values for certain properties, so that the tool is executed within the action. By doing this, simple and complex rules can be defined, where complex rules link the simple rules via operators.

Simple enabled condition example:

  • If Property “Suffix” has the value "cbl", the action can be executed.

A complex enabled condition contains any number of simple and complex enabled conditions, and links them via operators.

The visible condition defines whether an action, property or dialog input field is shown in the corresponding view, context menu or dialog. You can specify simple and complex rules for the condition in the same way as for enabled conditions.

The following table shows the relationships which enabled or a visible conditions can be defined:

Relationship Enabled Condition Visible Condition
Application Options has Application Action Yes Yes
Global Action has Workbench Action Yes Yes
Global Action has Editor Action Yes Yes
Element has GetChildren Action Yes No
Element has Action Yes Yes
Element has Property No Yes
Element List Structure has Action Yes Yes
File Descriptor has Action Yes Yes
Action has Tool Yes No
Tool has Input Parameter Yes Yes (modeled dialog)
Text Decoration has Decoration Value No Yes
In addition, the number of resources that can or must be selected so that an action is executable can be determined for an enabled condition or visible condition under the attribute Selection_Count. The Selection_Count attribute is only available for the relationships in the following list:
  • Application Option has Application Action
  • Global Action has Workbench Action
  • Global Action has Editor Action
  • Element has Action
  • Element List Structure has Action
  • File Descriptor has Action
The default value of Selection_Count is * this means that the number of selected resources is irrelevant for the evaluation of the condition.

If both an Enabled and Visible condition is defined for a relationship the two conditions are evaluated in the following way:

  1. Evaluate the Visible condition. If the Visible condition evaluates to false, the action is invisible.
  2. If the Visible condition evaluates to true, evaluate the Enabled condition. If the Enabled condition evaluates to false, disable the action.
  3. Otherwise, the action is shown and enabled.
Attribute Type Description
Selection_Count [O] String Number of resources that must be selected for the referenced action to be executable.

Permitted values:

* = Number of resources is irrelevant

0 = No resources may be selected

n = Exactly n (n = 1,2,3,...) resources must be selected

[*|n]-[*|n] = A range of numbers, for example, “2-*” = at least two resources must be selected.

Default value: *

Complex_Enabled_Condition (0..1)[D] Complex Condition Complex condition. Consists of several combined conditions.
Simple_Enabled_Condition (0..1)[D] Simple Condition Simple condition. Checks a property value for a specific value.
Modeling Action Enabled Condition

The enabled condition for an element action is specified here. It begins with a complex enabled condition (green dashed framed), which links the two simple enabled conditions (red framed) with the AND operator. AWM interprets this model as follows:

Action ACT_X from ElementType ELE1 can only be executed if the property value of PROP_Protected is false and corresponds to the property value of Property PROP_Group “TEST”. In addition, exactly one Element must be marked.

A simple enabled condition checks a property value for a defined value or status, and activates or deactivates the action depending on the result of the check. If the check is done during the execution of an action, for example, by a Tool Enabled Condition, a property value is first searched for among output parameters of the previous tools of the action and then in the context of the selected element(s).

Attribute Type Description
TargetID Property Reference to the property whose value should be checked.
Operator Selection The check operator.

Valid values include:

  • Equals…(+ Value)
  • Equals not…(+ Value)
  • Regular Expression... (+ Value)
  • NULL
  • NOT_NULL
  • TRUE
  • FALSE
Value [D] String A fixed value that is compared with that of the Property.

The meanings of the different operators are shown in the following table:

Operator Description Example
Equals… Checks whether the property value of the referenced property has the same value as specified in "Value". The action can only be executed if the selected element is a COBOL program:

TargetID = PROP_Type

Operator = Equals…

Value = COBOL

Equals not… Checks whether the property value of the referenced property has a value different from the specified "Value". The action can only be executed if the selected element is not in production:

TargetID = PROP_Stage

Operator = Equals not…

Value = PROD

Regular Expression Checks whether the property value of the referenced property matches with the regular expression specified in "Value".

This check is not case sensitive.

The action can only be executed on COBOL files:

TargetID = PROP_FileSuffix

Operator = Regular Expression…

Value = (cbl)|(cob)

NULL Checks whether the referenced property has no property value. The action can only be executed if the selected element has no access key:

TargetID = PROP_AccessKey

Operator = NULL

NOT_NULL Checks whether the referenced property has any property value. The action can only be executed if the selected element has a change date:

TargetID = PROP_ChangeDate

Operator = NOT_NULL

TRUE Checks whether the referenced property has the Boolean value true. The valid value for true which is checked during run time is defined in the property definition. The action can only be executed if the selected element can be edited:

TargetID = PROP_Editable

Operator = TRUE

FALSE Checks whether the referenced property has the Boolean value false. The valid value for false which is checked during run time is defined in the property definition. The action can only be executed if the selected element is not write-protected:

TargetID = PROP_Protected

Operator = FALSE

Examples


SCLM_ACT_CheckOut

The CheckOut action is only enabled in the SCLM model for an element that does not have an access key on it and if the element is editable.


SCLM_ACT_CompareNext

The CompareNext action is only enabled in the SCLM model if exactly one element is selected.


Property Visible

The property "COBOL File Dialect" is only visible in the Property view if the file is of type "COBOL Program".


NDV Delete Action

The above is an example of enabled conditions and parameter overrides in an Action_Has_Tool relationship. It is an example from the standard Endevor model supplied by Micro Focus. The delete action is designed to be executed in batch or online. Depending on the execution mode different tools are modelled. If the tool is executed in batch mode only the tools NDV_Tool_AWM_UI_Delete and NDV_TOOL_ISPF_REX_DeleteElementBatch are executed. If the tool is executed in online mode, the tools NDV_TOOL_AWM_UI_Delete, NDV_TOOL_ISPF_REX_DeleteElementOnline, NDV_TOOL_AWM_LocalTempFileCreator and NDV_TOOL_ECLIPSE_EditOpener are executed. In online mode the delete protocol is opened in the editor after the delete has been performed in Endevor. In the Action_Has_Tool relationship with the tool NDV_TOOL_AWM_LocalTempFileCreator, the parameter "File Name" is overwritten by the value of the property NDV_PROP_Element concatenated by the string "_DeleteProtocol". The parameter "Suffix" is overwritten by the static value "txt".