The JDeveloper Extension SDK is a framework of Java classes that allows for the development of third party add-ins (extensions) to the JDeveloper IDE. Pretty much any aspect of the JDeveloper user interface and functionality can be tapped into, from menus and toolbars to wizards and editors. This FAQ will focus on how to get started with the Extension SDK.
Main Theme
Downloading and Installing the Extension SDK
The JDeveloper Extension SDK can be downloaded directly from within JDeveloper via the Check for Updates functionality - under the Help menu - or from the Oracle JDeveloper Extensions Update Center on the web.
Once the Extension SDK is downloaded and installed, JDeveloper upon re-starting will give you the option to install the Extension SDK samples.
Selecting to do so will create and open a workspace with all available extension samples called extensionsdk.
In addition, a number of items related to extension development are installed in the New Gallery dialog.
Building Your First Extension
You can build your first JDeveloper extension by selecting Extension Project from the New Gallery dialog and clicking OK. In the Create Extension Project dialog we need to specify a few things related to extension such as the extension name, identifier and version.
Upon clicking OK on the Create Extension Project dialog, the extension project is created and the extension descriptor extension.xml editor is displayed.
The first thing we need to do is to create an extension Addin. An Addin performs programmatic initialization and registration of the extension. To do this, right-click on the extension project in the Application Navigator and select New... In the New Gallery dialog select Addin under the Extension Development category.
This will bring up the Create Addin dialog where we can specify the addin class name and package.
Click OK to go ahead with the creation of the addin. Observe the addin class that is created by JDeveloper. It implements the Addin Java interface which requires the implementation of the initialize() method. We will come back to the addin initialization later on.
Next we need to create an Action. An Action is an operation that may be invoked by JDeveloper. To do this, right-click on the extension project in the Application Navigator and select New... In the New Gallery dialog select to create an Action under the Extension Development category.
This will bring up the Create Action dialog. In this dialog we will specify a few details related to the action that we are about to create such as the name, identifier and classes of the action.
Go ahead and specify the action details and when done click OK. In this case we will create an ADF Application Module Verifier action. This action will do a number of verifications on the Application Module. JDeveloper proceeds with the creation of the action Command and Controller classes.
Observe the Command class generated by JDeveloper. It extends the Command class and implements the abstract method doit(). It is inside this method where code will be written to implement the action.
Now that we have an action created, we can return to the addin initialize() method and write the necessary code to hook-up the action to the JDeveloper Tools menu. We will create an ADF Tools submenu, add the Application Module Verifier action we just created and add the ADF Tools submenu to the JDeveloper Tools menu. This is shown below.
Now we are ready to test our extension! In the Application Navigator right-click on the extension project and select Run Extension.
This will start a second instance of JDeveloper which will include our extension and will allow us to see our extension in action. Indeed, you should be able to see the extension under the Tools menu.
Conclusion
Developing JDeveloper extensions (addins) becomes fairly easy once you install the Extension SDK and start using the Extension Project, Addin and Action wizards in the New Gallery dialog. Your task becomes writing the plumbing code in the Addin initialize() and in the Action Command doit() methods.
Until the next time, keep on JDeveloping!
Code
http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo16.rar
thank you very much
ReplyDeleteDownload and try Red Samurai extension - http://andrejusb.blogspot.com/2010/03/red-samurai-tool-jdeveloper-11g.html
ReplyDeleteAndrejus
Thanks Andrejus. I'll give it a try.
ReplyDeleteVery nice and helpful post Nick. Just what you need to jump-start on extension development
ReplyDelete