Compound Actions: oxy_compound_action() Function
This function allows you to define multiple actions that will be executed sequentially.
The oxy_compound_action()
function is used from the oxy_button() form control function or the
oxy_buttonGroup() form control
function.
The arguments received by the oxy_compound_action()
function are a list of actions (executed sequentially) that are defined with the oxy_action() function.
You can use three optional properties (name
,
description
, icon
) in the
oxy_compound_action()
function to provide labels for the compound action.
If you do not specify these three properties, those same properties defined in the first
oxy_action function will be used for the labels.
- name - The name of the action. It will be displayed as the label for the action. If you want to reuse the name of an action already defined in your framework, you can use the oxy_getActionName function.
- description - A short description with details about the result of the action. It will be displayed in a tooltip when hovering over the button linked to this action. If you want to reuse the description of an action already defined in your framework, you can use the oxy_getActionDescription function.
- icon - A path relative to the CSS pointing to an
image (the icon for the action). The path can point to resources that are packed in Oxygen XML Editor (oxygen.jar) by starting its value with
/
(for example, /images/Remove16.png). It can also be expressed as an editor variable. If you want to reuse the icon of an action already defined in your framework, you can use the oxy_getActionIcon function.
- framework.defined.action.id (required) - The ID of an action defined in the current framework that gets the name, description, or icon for that action.
- fallback (optional) - A fallback value in
case the ID value provided in the
framework.defined.action.id
parameter is not found.
Example: oxy_compound_action
Function
oxy_button(
action,
oxy_compound_action(
name, oxy_getActionName('framework.id', 'Fallback'),
description, 'Inserts a paragraph and uses form controls to edit its @audience attribute',
icon, url('http://www.oxygenxml.com/img/icn_oxy20.png'),
oxy_action(
name, 'Insert',
description, 'Insert an element after the current one',
operation, 'ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation',
icon, url('insert.png'),
arg-fragment, "<p audience=''></p>",
arg-insertLocation, '.',
arg-insertPosition, 'After'
),
oxy_action(
name, 'Activate edit mode',
description, 'Sets a pseudo class that will activate a CSS rule that will present a text field form control for the @audience attribute',
operation, 'SetPseudoClassOperation',
arg-name, 'edit-mode-on',
arg-elementLocation, '.'
)
)
, showIcon, true)
Tip: A code template is available to make it easy to add the
oxy_compound_action
function with the Content Completion
Assistant by pressing Ctrl +
Space and select the
oxy_action_list
code template.