Shay Shmeltzer's Oracle Development Tools Tips

  • January 8, 2009

Declarative Extension building for JDeveloper with the extension.xml

Shay Shmeltzer
Director of Product Management - Oracle

Now that the Tomcat extension for JDeveloper is out there, it is time to summarize some of the new thing I learned while building this extension.

One key thing is that the extension.xml file can do a lot more than just describe your extension - it can actually save you a lot of coding needed in the past to hook up the parts of your extension to the IDE.

You can get the source of the Tomcat extension from here - and follow along.

When you look in the extension.xml file you'll see for example this part:

<action id="shay.tomcat.starttomcat">


<property name="Name">Start Tomcat</property>

<property name="SmallIcon">res:/shay/tomcat/t002.gif</property>

<property name="LongDescription">start Tomcat</property>





This define an action - an operation - in JDeveloper - you give it an id and point to the calsses that implement it.

Then you can use the above id to add menus and toolbar button that invoke the action inside JDeveloper.

See for example this part in the extension.xml for adding a menu:


<menubar id="javax.ide.view.MAIN_WINDOW_MENUBAR_ID">

<menu id="34" after="javax.ide.HELP_MENU_ID">


<section id="Tomcat">

<item action-ref="shay.tomcat.starttomcat"/>

<item action-ref="shay.tomcat.stoptomcat"/>

<item action-ref="shay.tomcat.starttomcatdbg"/>





And this part for adding a toolbar buttons:


<toolbar id="javax.ide.view.MAIN_WINDOW_TOOLBAR_ID">

<!-- Add a new section after the first section in the toolbar. -->

<section id="javax.ide.tck.toolbar.tomcatsection"

after="javax.ide.COPY_PASTE_SECTION_ID ">

<item action-ref="shay.tomcat.starttomcat"/>

<item action-ref="shay.tomcat.stoptomcat"/>

<item action-ref="shay.tomcat.starttomcatdbg"/>




Another thing that you can hook up in a declarative way is a new section for the tools->preferences menu.

You just create the class to implement the preferences structure and then in the extension.xml file you add:

<settings-ui-hook xmlns="http://xmlns.oracle.com/ide/extension">

<page id="shay.tomcat.tomcatpreferences" parent-idref="/preferences">

<label>Tomcat Preferences</label>




As you can see these hook points are quite powerful and can save some coding efforts, and they are actually part of JSR 198 - you can learn more about them in the JDeveloper online help topic "Specifying Optional JSR198 Standard and Custom Extension Points".

There are more samples of using these features in the set of examples that come with the Extension SDK. Have a look and try it out the next time you build a JDeveloper extension.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.