The oxy_action() function allows you to define actions directly in the
CSS, rather than referencing them from the associated framework.
The oxy_action() function is used from the
oxy_button() function.
The arguments received by the oxy_action() function are a list of properties
that define an action. The following properties are supported:
- name - The name of the action. It will be displayed as the label for
the button or menu item.
- description (optional) - A short description with details about the
result of the action.
- icon (optional) - 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 editor
variables.
- operation - The name of the Java class implementing the ro.sync.ecss.extensions.api.AuthorOperation interface.
There is also a variety of predefined operations that can be used.
Note: If the name of the operation
specified in the CSS is not qualified (has no Java package name), then it is considered
to be one of the built-in Oxygen XML Editor operations from
ro.sync.ecss.extensions.commons.operations package. If the class is
not found in this package, then it will be loaded using the specified name.
- arg-<string> - All arguments with the arg-
prefix are passed to the operation (the string that follows the arg-
prefix is passed).
- ID - (optional) - The ID of the action from the framework. If this is
specified, all others parameters are disregarded.
oxy_button(
action, oxy_action(
name, 'Insert',
description, 'Insert an element after the current one',
icon, url('insert.png'),
operation,
'ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation',
arg-fragment, '<element>${caret}</element>',
arg-insertLocation, '.',
arg-insertPosition, 'After'),
showIcon, true)
Tip: A code template is available to make it easy to add the
oxy_action function with the
Content Completion
Assistant by pressing
Ctrl Space (Command Space on OS
X) and
select the
oxy_action code template..