Thursday, May 04, 2006

Forgotten tabs

So, you say we missed adding a partition tab or a MV column stats. I'd say it's an opportunity for you to add it exactly how you'd like it. This can all be done via xml and a command line flag


It's really easy to add tabs to an object when clicked in the tree.


<?xml version="1.0" encoding="UTF-8"?>
<items>
<item type="editor" node="TableNode" vertical="true">
<title><![CDATA[Modifications]]></title>
<query>
<sql><![CDATA[select * from ALL_TAB_MODIFICATIONS where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME]]></sql>
</query>
</item>
</items>


Hopefully most of this is pretty straight forward. Here's a few thing explained:

First the item tag has a couple attibutes

type="editor"This is required right now and the only value is "editor"

node="TableNode" This is the node which the tab will show up on. See the list below for all supported values.

vertical="true"This will make the report vertical since I know this sql will return only 1 row. It makes it much easier to read. Leave this attribute out or no value and the report will be a normal data grid of the results

Here's the list of valid values for the node attribute:
IndexNode
TriggerNode
PlSqlBaseNode
MViewLogNode
DatabaseLinkNode
RecycledObjectNode
SequenceNode
SynonymNode
MViewNode
ViewNode

The thing that probably stands out is the binds. Here's the list of binds that are supported:
:OBJECT_NAME name of the object
:OBJECT_TYPE type of the object
:OBJECT_OWNER owner of the object
:COLUMN_NAME name of the column ( if a column was right clicked
:OBJECT_ID object_id from all_objects
:USER user which is connected to the database

Now all that's needed is to tell SQL Developer to load the file. This is very easy:

-Draptor.user.editors=/home/klrice/editors.xml

There can only be one file right now. In a future release, I'll get a registerEditors call added as well as the ability to have multiple files passed on the command line just like the snippets and reports have now.

If people find this usefull , well I'll do it anyway. I'll follow this up with how to add master/detail ( index columns ) and top results with bottom code ( triggers ).

No comments: