Global Action is an Editor Action

By specifying the complex attribute ISA Editor Action, the corresponding global action acts as an editor action.

An editor action appears in the context menu of an editor if the file suffix of the opened file matches one of the modeled editor suffixes. See Global Action for information about restrictions.

Editor actions can use the editor’s context if the editor is opened by a modeled action. See Validate Action for more information.

You can also dynamically use the cursor position or text selection to add properties to the action context. To do this, model a selection property mapping. It specifies which value from the user’s editor selection (or cursor position) should be mapped to which property.

Additionally, you can configure a keyword sensitive property mapping. Keywords can be any statement of a specific programming language, such as a COBOL Copy statement. Keywords can only be identified by specific keyword parsers, when the opened editor contains valid program code. The keyword parser can identify a keyword depending on the cursor position, and return its value, for example, the name of the include file of a COBOL Copy statement. The advantage of using keywords for selection property mappings is that you can disable the editor action if the specific keyword is not selected. Without keyword parsers, you must correctly select the desired value in the editor while the editor action always executes without any validation. 

Attribute Type Description
Editor Suffixes * String[] Blank separated list of file suffixes for which the editor action applies (case insensitive). If the action should appear in all text editors, an asterisk (*) must be used.

The suffix is interpreted in a generic way. All files having a suffix ending with a string within the list determines the editor action. If you want the action only to be shown for files with specific suffixes, you have to specify the suffixes with the preceding period.

For example:

.COB .CBL

Result: The editor action appears in the context menu of any text editor for files with the suffix COB or CBL (such as MYPROG.cbl)

The default value is an asterisk (*).
Modeled Edit Sessions Only Boolean Specifies whether the action should be restricted to editor sessions opened by modeled AWM actions. When set to false, the action is shown in every supported, matching editor, even if no AWM context is available.

The default value is true.

Update Edit Context Boolean Specifies whether tools of the editor action can update the editor’s context.

If set to true, tools of the editor actions can update the editor’s context.

Note: The editor’s context is used by the save/close action. This means, if this attribute is set to true and a tool of the editor action has as output parameter a property used by the save/close action, the save/close action uses the changed value of the property.

The default value is false.

Selection Property Mapping [O] Selection Property Mapping 0..* Complex attribute that maps a specific text selection in the editor to a property. Can be used as an input parameter for tools within the action.

Attributes for the relationship: ISA Editor Actor to Selection Property Mapping

Attribute Type Description
TargetID * Property References a property to which the text selection should be mapped.
Value From Selection Specifies which value from the user’s editor selection (or cursor position) should be mapped to the property.

Valid values include:

  • SelectedText: The selected (marked) text
  • SelectedWord: The selected word (cursor position)
  • SelectedLine: The selected line (cursor position)
  • SelectedKeyword: The selected keyword (cursor position)
Keyword [D] Selection The name of the keyword that should be used for the property mapping. The selectable values for this attribute depend on the installed keyword parsers. By default, these are:
  • COBOL – COPYBOOK
  • COBOL – INCLUDE
  • PL1 - INCLUDE

Only relevant if Value From has the value SelectedKeyword.

Mandatory [D] Boolean If set to true, the editor action does not execute if the cursor is not placed on the specified keyword.

Only relevant if Value From has the value SelectedKeyword.

Example

An example for the use of the "Value From" attribute could be an editor action which returns the count of words of the selected text or selected line.

You have to model a tool with a text input parameter which is the property referenced under "Target ID" in the Selection Property Mapping relation of the ISA_Editor_Action relationship (PROP_AWMTEST_InputLine in the sample below). The tool returns the number of words of the input text. The property which contains the return value with the number of words in the input text could, for example, be modeled as input parameter of an AWM output dialog.

The editor action for this use case could be modeled in this way:


Select Line Editor Action

Select Line Properties