The Insert Table Action

You will create an action that inserts into the document a table with three rows and three columns. The first row is the table 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:
    1. Set XPath expression field to true(). true() is equivalent with leaving this field empty.
    2. Set Invoke operation to use InvokeFragmentOperation built-in operation that inserts an XML fragment to the caret position.
    3. Configure operation's arguments as follows:

      fragment - set it to:

      <table xmlns=
      "http://www.oxygenxml.com/sample/documentation">
        <header><td/><td/><td/></header>
        <tr><td/><td/><td/></tr>
        <tr><td/><td/><td/></tr>
      </table>

      insertLocation - to add tables at the end of the section use the following code:

      ancestor::section/*[last()]

      insertPosition - Select After.