function doOperation(){
//The current node is either entirely selected...
currentNode = authorAccess.getEditorAccess().getFullySelectedNode();
if(currentNode == null){
//or the cursor is placed in it
caretOffset = authorAccess.getEditorAccess().getCaretOffset();
currentNode = authorAccess.getDocumentController().getNodeAtOffset(caretOffset);
}
//Get current value of the @type attribute
currentTypeValue = "";
currentTypeValueAttr = currentNode.getAttribute("type");
if(currentTypeValueAttr != null){
currentTypeValue = currentTypeValueAttr.getValue();
}
//Ask user for new value for attribute.
newTypeValue = javax.swing.JOptionPane.showInputDialog("Input @type value", currentTypeValue);
if(newTypeValue != null){
//Create and set the new attribute value for the @type attribute.
attrValue = new Packages.ro.sync.ecss.extensions.api.node.AttrValue(newTypeValue);
authorAccess.getDocumentController().setAttribute("type", attrValue, currentNode);
}
}
declare namespace oxyxq = "http://www.oxygenxml.com/ns/xqu";
(: This variable will be linked to the selected nodes assuming that there are
actually fully selected nodes. For example this selection will return null:
<p>{SEL_START}text{SEL_END} in para</p>
but this will give two "p" elements:
{SEL_END}<p>text</p><p>text2</p>{SEL_END}
If a multiple selection exists it will also be processed and forwarded.
Again, only fully selected nodes will be passed.
:)
declare variable $oxyxq:selection external;
(: We will process either the selection or the context node :)
let $toProcess := if (empty($oxyxq:selection)) then
(.)
else
($oxyxq:selection)
return
if (not(empty($toProcess))) then
(
(: Create the list :)
let $ul :=
<ul>
{
for $sel in $toProcess
return
<li>{$sel}</li>
}
</ul>
return
(
(: Delete the processed nodes :)
for $sel in $toProcess
return
delete node $sel,
(: Inserts the constructed list :)
insert node $ul
before $toProcess[1]
)
)
else
()
Let's consider that there is a pseudo-class called myClass on the element paragraph and there are CSS styles matching the pseudo-class.
paragraph:myClass{
font-size:2em;
color:red;
}
paragraph{
color:blue;
}
In the previous example, by removing the pseudo-class, the layout of the paragraph is rebuilt by matching the other rules (in this case, the foreground color of the paragraph element will become blue.
name - Name of the pseudo-class to be toggled on/off.
paragraph:myClass{
color:red;
}
paragraph{
color:blue;
}
By default, the paragraph content is rendered in blue. Suppose that we have a TogglePseudoClassOperation configured for the myClass pseudo-class. Invoking it the first time will set the myClass pseudo-class and the paragraph will be rendered in red. Invoking the operation again, will remove the pseudo-class and the visible result will be a blue rendered paragraph element.
ExecuteMultipleWebappCompatibleActionsOperation
An implementation of an operation that runs a sequence of Oxygen XML WebApp-compatible actions, defined as a list of IDs.
DeleteElementsOperation
Deletes the nodes indicated by the elementLocations parameter XPath expression. If missing, the operation will delete the node at the cursor location.
Deletes the node indicated by the elementLocation parameter XPath expression. If missing, the operation will delete the node at the cursor location.
Insert an XInclude element at the cursor offset. Opens a dialog box that allows you to browse and select content to be included in your document and automatically generates the corresponding XInclude instruction.
| Parameter | |
|---|---|
| url | Format: ${ask('message', url, 'default_value')} |
| Description: Input is considered a URL. Oxygen XML Editor checks that the provided URL is valid. | |
Example:
|
|
| password | Format: ${ask('message', password, 'default')} |
| Description: The input is hidden with bullet characters. | |
Example:
|
|
| generic | Format: ${ask('message', generic, 'default')} |
| Description: The input is considered to be generic text that requires no special handling. | |
Example:
|
|
| relative_url | Format: ${ask('message', relative_url, 'default')} |
| Description: Input is considered a URL. Oxygen XML Editor
tries to make the URL relative to that of the document you are
editing. Note: If the $ask editor variable is expanded in
content that is not yet saved (such as an untitled file, whose
path cannot be determined), then Oxygen XML Editor will transform it
into an absolute URL.
|
|
|
Example:
|
|
| combobox | Format: ${ask('message', combobox, ('real_value1':'rendered_value1';...;'real_valueN':'rendered_valueN'), 'default')} |
| Description: Displays a dialog box that offers a drop-down menu.
The drop-down menu is populated with the given rendered_value
values. Choosing such a value will return its associated value
(real_value). Note: The 'default' parameter
specifies the default selected value and can match either a key or a
value.
|
|
Example:
|
|
| editable_combobox | Format: ${ask('message', editable_combobox, ('real_value1':'rendered_value1';...;'real_valueN':'rendered_valueN'), 'default')} |
| Description: Displays a dialog box that offers a drop-down menu
with editable elements. The drop-down menu is populated with the given
rendered_value values. Choosing such a value will return
its associated real value (real_value) or the value inserted
when you edit a list entry. Note: The 'default' parameter
specifies the default selected value and can match either a key or a
value.
|
|
Example:
|
|
| radio | Format: ${ask('message', radio, ('real_value1':'rendered_value1';...;'real_valueN':'rendered_valueN'), 'default')} |
| Description: Displays a dialog box that offers a series of radio
buttons. Each radio button displays a 'rendered_value and
will return an associated real_value. Note: The
'default' parameter specifies the default selected value
and can match either a key or a value.
|
|
Example:
|