See what I miss by going on vacation. I just happen to be looking at old blogs and ran across this one. So this one will explain how to add to the right click menu using nothing but xml. Hopefully most of the xml is obvious. As an example, I'll use the right for table to change logging vs. nologging.



<items>
<item type="TABLE">
<title>Logging</title>
<prompt>
<label>Logging:</label> <value><![CDATA[STATIC:LOGGING:NOLOGGING]]></value>
<default><![CDATA[select logging from all_tables where owner = :OBJECT_OWNER and table_name = :OBJECT_NAME]]></default>
</prompt>
<prompt type="confirm">
<label>Change logging status of selected table?</label>
</prompt>
<sql><![CDATA[alter table "#OBJECT_OWNER#"."#OBJECT_NAME#" #0#]]></sql>
<help>Change the logging status of a table. LOGGING will log changes to the redo log file.<br/>
NOLOGGING will not log changes to the redo log file.</help>
<confirmation>
<title>Confirmation</title>
<prompt>Table "#OBJECT_NAME#" set to #0#</prompt>
</confirmation>
</item>
</items>


While there's a lot more xml, hopefully the simplicity of this is not lost. Here's what it looks like in the tool:



Hopefully most of the xml is obvious. Here's a break down of the tags:

Prompts:
prompt - This is a prompt for user input. The user's input can be referenced when submitted as #0# for direct substituition.
label - This is the label of the prompt
value - This has a few choices.
- If omitted , the user will be presented a text field for free-form input
- To have a static list of values STATIC:A:B:B
- To have a select base list <value><![CDATA[select :OBJECT_OWNER from dual ]]></value> ( more on binds later )
default - This can be a single value or if a select SQL Developer will grab the first column of the first row

The next prompt is a confirm, a prompt of this type is just text to the user. There is no input.

Now for the actual code to be executed against the DB. The contents of the sql tag will have #0# ... #N# replaced with the values from the user prompts. Also available are:
#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

The rest should be easy if your eyes have not glazed over by now the rest should be easy. The help is just what is shown when the help button is clicked.
The confirmation is what is presented to the user once the sql has been executed successfully.

Finally pass the command like -Draptor.user.contextmenu=/path/to/file:/path/to/file2

Now that you've made it this far. You can see how the values entered by the user are passed to the sql to be executed. This mean the code in the sql block has to handle all the inputs and deal with them. If you really want to see this, check out the code generated by Table->Column->Normalize.


----- Updated 5/9------
I should have said to pass the new menus, these are the choices
sqldeveloper -J-Draptor.user.contextmenu=/path/to/file:/path/to/file2
or edit sqldeveloper.conf
AddVMOption -Draptor.user.contextmenu=/path/to/file:/path/to/file2