Configure the Insert Table Action for a Framework

The procedure described below will create an action that inserts a table with three rows and three columns into a document. The first row is the table header. As with the insert section action, you will use the InsertFragmentOperation built-in operation.

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 table element.
  5. Set Toolbar icon to ${framework} / toolbarIcon.png.
  6. Set Menu icon to ${framework} / menuIcon.png.
  7. Set Shortcut key to Ctrl + Shift + T (Command + Shift + T on OS X).
  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 InsertFragmentOperation built-in operation that inserts an XML fragment to the cursor 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.

Was this helpful?