Introduction
The two examples here demonstrate how to create 3 or 4 levels of navigation in the database navigator.
For example the table navigation uses 3 levels.
In certain circumstances you may want to have another level of detail in the navigator.
Three Level Example
This example can be downloaded here
ftp://ftp.oracle.com/svrtech/outgoing/sqldev_sdk/xml_nav_subfolder_subnode.zip
<?xml version="1.0" encoding="windows-1252" ?>
<navigator RESOURCE_FILE="oracle.dbtools.raptor.navigator.OracleNavigatorResource"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="navigator.xsd">
<objectType connType="Oracle" id="3Level_Tablespaces" weight="100.0" includesSyns="true">
<folder> <!-- level1 -->
<icon RSKEY="TABLE_FOLDER_ICON" />
<label RSKEY="Level1 of 3" />
<queries> <!-- level2 -->
<query minversion="8">
<sql constrained="true">
<![CDATA[SELECT 'a' name FROM DUAL UNION
SELECT 'b' name FROM DUAL UNION
SELECT 'c' name FROM DUAL]]>
</sql>
</query>
<columns>
<column filterable="true" sortable="true" id="NAME">
<colName>
<![CDATA[name]]>
</colName>
</column>
<column filterable="true" sortable="true" id="TESTNAME">
<colName>
<![CDATA[name]]>
</colName>
</column>
</columns>
</queries>
</folder>
<node> <!-- level2's details -->
<icon RSKEY="OracleIcons.TABLE" />
<childType id="Level3"> <!-- Level3 -->
<icon RSKEY="OracleIcons.COLUMN" />
<queries>
<query>
<sql> SELECT '1' || :PARENT_NAME name FROM DUAL
UNION SELECT '2' || :TESTNAME name FROM DUAL
UNION SELECT '3' || :PARENT_NAME name FROM DUAL </sql>
</query>
<columns>
<column filterable="true" sortable="true" id="NAME">
<colName><![CDATA[name]]></colName>
</column>
</columns>
</queries>
</childType>
</node>
</objectType>
</navigator> Copy the code above and paste it into a new file such as threeLevel_nav.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 NAVIGATOR from the list.
- Click in the Location field, and click Browse to add the location of the threeLevel_nav.xml file.
- Restart Oracle SQL Developer to register this new extension.
You should now see that you can browse a "Level1 of 3" node in the databases navigator.
Four Level Example
<?xml version="1.0" encoding="windows-1252" ?>
<navigator RESOURCE_FILE="oracle.dbtools.raptor.navigator.OracleNavigatorResource"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="navigator.xsd">
<objectType connType="Oracle" id="4Level_Tablespaces" weight="100.0" includesSyns="true">
<folder> <!-- level1 -->
<icon RSKEY="TABLE_FOLDER_ICON" />
<label RSKEY="Level1 of 4" />
<queries> <!-- level2 -->
<query minversion="8">
<sql constrained="true">
<![CDATA[SELECT 'a' name FROM DUAL UNION
SELECT 'b' name FROM DUAL UNION
SELECT 'c' name FROM DUAL]]>
</sql>
</query>
<columns>
<column filterable="true" sortable="true" id="NAME">
<colName>
<![CDATA[name]]>
</colName>
</column>
<column filterable="true" sortable="true" id="TESTNAME">
<colName>
<![CDATA[name]]>
</colName>
</column>
</columns>
</queries>
</folder>
<node> <!-- level2's details -->
<icon RSKEY="OracleIcons.TABLE" />
<childType id="Level3" nodeType="Level3"> <!-- Level3 -->
<icon RSKEY="OracleIcons.COLUMN" />
<queries>
<query>
<sql> SELECT '1' || :PARENT_NAME name FROM DUAL
UNION SELECT '2' || :TESTNAME name FROM DUAL
UNION SELECT '3' || :PARENT_NAME name FROM DUAL </sql>
</query>
<columns>
<column filterable="true" sortable="true" id="NAME">
<colName><![CDATA[name]]></colName>
</column>
</columns>
</queries>
</childType>
</node>
</objectType>
<objectType connType="Oracle" id="Level3" weight="">
<node>
<icon RSKEY="OracleIcons.COLUMN" />
<childType id="Level4" nodeType="Level4">
<icon RSKEY="OracleIcons.TABLE" />
<queries>
<query>
<sql> SELECT '+' || :PARENT_NAME name FROM DUAL
UNION SELECT '%' || :TESTNAME name FROM DUAL
UNION SELECT '*' || :PARENT_NAME name FROM DUAL
</sql>
<columns>
<column id="NAME">
<colName><![CDATA[NAME]]></colName>
</column>
</columns>
</query>
</queries>
</childType>
</node>
</objectType>
<objectType connType="Oracle" id="Level4" weight="">
<node>
<icon RSKEY="OracleIcons.TABLE" />
</node>
</objectType>
</navigator>
Copy the code above and paste it into a new file such as fourLevel_nav.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 NAVIGATOR from the list.
- Click in the Location field, and click Browse to add the location of the fourLevel_nav.xml file.
- Restart Oracle SQL Developer to register this new extension.
You should now see that you can browse a "Level1 of 4" node in the databases navigator.
Create a Right Click Action
The following user defined extension defines an action for the forth level node.
<?xml version="1.0" encoding="UTF-8"?>
<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="dialogs.xsd">
<item type="Level4" reload="true" removeFromParent="true">
<title>Rename Level4</title>
<iconName>oracle.ide.resource.IdeArb:RENAME_ICON</iconName>
<prompt>
<label>New Table Name</label>
<default><![CDATA[SELECT 'DefaultName' FROM DUAL]]></default>
</prompt>
<prompt type="confirm">
<label><![CDATA[Are you sure you want to rename this Level4?]]></label>
</prompt>
<sql>
<![CDATA[ALTER BLAH BLAH BLAH #0#]]>
</sql>
<help>Renames the selected Level4</help>
<confirmation>
<title>Confirmation</title>
<prompt>Level4 "#OBJECT_NAME#" has been renamed to #0#</prompt>
</confirmation>
</item>
</items>