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.
- Set ID field to insert_table.
- Set Name field to Insert table.
- Set Menu access key field to t.
- Set Description field to Adds a table element.
- Set Toolbar icon to ${framework} / toolbarIcon.png.
- Set Menu icon to ${framework} / menuIcon.png.
- Set Shortcut key to Ctrl + Shift + T (Command + Shift + T on OS X).
- Set up the action's functionality:
- Set XPath expression field to
true()
.true()
is equivalent with leaving this field empty. - Set Invoke operation to use InsertFragmentOperation built-in operation that inserts an XML fragment to the cursor position.
- 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.
- Set XPath expression field to