Closed ffm145 closed 3 years ago
Hi @ffm145,
- is it possible to create subnodes from root node with individual icons?
I guess it is possible by using dedicated object types. But I have not tried it. You can consult the navigator.xsd to see what's possible. Here's the graphical representation of the relevant part:
- is it possible to create a leaf subnode from root node?
Yes this is possible. I showed that in my talk named "Extend Your SQL Developer" from 2020-10-29. You find links to the slides and to the video here. See slides 36-38.
Thanks a lot for the links. Very interesting. Question 2 is almost answered with the example in your slides although they all (must?) have the same icon and a combination of single nodes and subnodes with childs (see my screenshot) seems not to work... Regarding question 1 i tried a lot of possible combination - all without success! :( In this context I tried to manipulate the order of the tree nodes, but neither order by in the sql query works nor the weight attribute in objectType. Also interesting is that navigator.xsd define for ICON RSKEY and PATH as attributes. But path seems not to work (I tried gif and png), do you have any experience with that?
Heres my code for Question 2:
<navigator RESOURCE_FILE="oracle.dbtools.raptor.navigator.OracleNavigatorResource">
<objectType connType="Oracle" id="drinks-root" weight="20">
<folder>
<icon RSKEY="OracleIcons.HOME"></icon>
<label RSKEY="Working"/>
<queries>
<query>
<sql constrained="true">
<![CDATA[
select * from (
select 'usER' as name, 'USER' as value from dual
union all
select 'teAM' as name, 'TEAM' as value from dual
) order by 1 desc
]]>
</sql>
</query>
</queries>
</folder>
<node>
<childType id="user-folder" nodeType="user-folder">
<icon RSKEY="OracleIcons.USER"></icon>
<queries>
<query>
<sql>
<![CDATA[
select 'Max' as name, 'egal' as value from dual where :VALUE = 'USER'
]]>
</sql>
</query>
</queries>
</childType>
<childType id="team-folder" nodeType="team-folder">
<icon RSKEY="OracleIcons.TEAM" />
<queries>
<query>
<sql>
<![CDATA[
select 'Heroes' as name, 'wurscht' as value from dual where :VALUE = 'TEAM'
]]>
</sql>
</query>
</queries>
</childType>
</node>
</objectType>
</navigator>
Question 2 is almost answered with the example in your slides although they all (must?) have the same icon (...)
No, you can have different icons. See screenshot below (below node Soft drinks
. Schweppes
is based on a dedicated child query which produces a own object type with its own icon.
Regarding question 1 (...) I tried to manipulate the order of the tree nodes, but neither order by in the sql query works nor the weight attribute in objectType.
You must use the weight
attribute to control the order of the nodes.
Also interesting is that navigator.xsd define for ICON RSKEY and PATH as attributes. But path seems not to work (I tried gif and png), do you have any experience with that?
In a pure XML extension you can only reference existing icons. I explained that in the talk I mentioned above. If you want to use your own icons you have to build a bundled XML extension. See workshop. The resource key and path attribute you mentioned work only from a Java extension perspective. You cannot access arbitrary files on the file system. It's not built for that.
I added an additional example drinks-navigator-with-categories.xml
. It produces this navigator tree:
This should fully answer your questions.
While you can accomplish a lot with pure XML extensions, there are still limitations. When you hit those limits, you either need to reconsider your requirements or turn to bundled or full-featured Java-based extensions.
Closed due to inactivity.
Hey Philipp! Thanks a lot for this great tutorial... Two questions about your navigator extension example (https://github.com/PhilippSalvisberg/sqldev/tree/main/workshop/030_create_navigator_xml_extension/README.md#create-navigator-xml-extension): 1) is it possible to create subnodes from root node with individual icons? (it seems that
objectType > node > icon
is used for all following childTypes) 2) is it possible to create a leaf subnode from root node? (in your example there are only childTypes which are connected with the root query via the bindvariable :VALUE)For better understanding I manipulate a screenshot:
Unfortunately this question is not covered by the Oracle examples (https://github.com/oracle/oracle-db-examples/tree/master/sqldeveloper/extension/xml/individual)