24.08.2015 Views

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Author</strong> Developer Guide | 1727. Click the text field next to Shortcut key and set it to Ctrl+Shift+S. This will be the key combination to trigger theaction using the keyboard only.The shortcut is enabled only by adding the action to the main menu of the <strong>Author</strong> mode which contains all the actionsthat the author will have in a menu for the current document type.8. At this time the action has no functionality added to it. Next you must define how this action operates. An actioncan have multiple operation modes, each of them activated by the evaluation of an XPath version 2.0 expression.The scope of the XPath expression must be only element nodes and attribute nodes of the edited document, otherwisethe expression will not return a match and will not fire the action. For this example we'll suppose you want allowthe action to add a section only if the current element is either a book, article or another section.a) Set the XPath expression field to:local-name()='section' or local-name()='book' orlocal-name()='article'b) Set the invoke operation field to InsertFragmentOperation built-in operation, designed to insert an<strong>XML</strong> fragment at caret position. This belongs to a set of built-in operations, a complete list of which can be foundin the <strong>Author</strong> Default Operations section. This set can be expanded with your own Java operation implementations.c) Configure the arguments section as follows:insertLocation - leave it empty. This means the location will be at the caret position.insertPosition - select "Inside".The Insert Table ActionYou will create an action that inserts into the document a table with three rows and three columns. The first row is thetable header. Similarly to the insert section action, you will use the InsertFragmentOperation.Place the icon files for the menu item and for the toolbar in the frameworks / sdf directory.1. Set ID field to insert_table.2. Set Name field to Insert table.3. Set Menu access key field to t.4. Set Description field to Adds a section element.5. Set Toolbar icon to ${frameworks} / sdf / toolbarIcon.png.6. Set Menu icon to ${frameworks} / sdf / menuIcon.png.7. Set Shortcut key to Ctrl+Shift+T.8. Set up the action's functionality:a) Set XPath expression field to true().true() is equivalent with leaving this field empty.b) Set Invoke operation to use InvokeFragmentOperation built-in operation that inserts an <strong>XML</strong> fragment to thecaret position.c) Configure operation's arguments as follows:fragment - set it to:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!