Introduction
This example shows how to create a new Right Click action from a particular node in the navigator.
In this example nodes of type Table are given the action "Rename Table".
A dialog is opened with a textfield for the New Table Name.
There is also a confirmation text.
SQL "ALTER TABLE" is used to change the name of the table.
Example
<?xml version="1.0" encoding="UTF-8"?>
<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="dialogs.xsd">
<item type="TABLE" reload="true" removeFromParent="true">
<title>Rename Table</title>
<iconName>oracle.ide.resource.IdeArb:RENAME_ICON</iconName>
<prompt>
<label>New Table Name</label>
</prompt>
<prompt type="confirm">
<label><![CDATA[Are you sure you want to rename this TABLE?]]></label>
</prompt>
<sql>
<![CDATA[alter table "#OBJECT_OWNER#"."#OBJECT_NAME#" rename to #0#]]>
</sql>
<help>Renames the selected table</help>
<confirmation>
<title>Confirmation</title>
<prompt>Table "#OBJECT_NAME#" has been renamed to #0#</prompt>
</confirmation>
</item>
</items>Copy the code above and paste it into a new file such as table_action.xml.
- Open Oracle SQL Developer, select Tools -> Preferences. Expand the Database node, and select User Defined Extensions.
- Click Add Row, click in the Type field, and select ACTION from the list.
- Click in the Location field, and click Browse to add the location of the table_action.xml file.
- Restart Oracle SQL Developer to register this new extension.
You should now see that there is an action available (Rename Table), when you right click on a table node in the databases navigator.