Running a one-time post Install task in a JDeveloper Extension

If you'll check for updates today in your JDeveloper you'll see a new extension that contains additional skins that you can use in your ADF Faces application.
The two new skins there were created by the WebCenter team as part of their new offering. And they were nice enough to share it with the community and posted links to these two zip files on their samples page.

However, I guessed that many JDeveloper users won't know about them if they just stay there, so I went ahead and created an extension that will give more exposure to the existence of these new skins.

All the extension does is download the skin files to your machine, but the part I was missing was how do I tell people where the files are and how to use them. So what I wanted to have is a help page that will pop-up and tell people where the files are once the installation finished.

Luckily, the JDeveloper extension mechanism has a post-install hook that takes care of this scenario.

All you need to do is create a new class that extend PostStartupHook (from the oracle.ide.webupdate package) and in this class implement the method install.
In my case it just calls these two lines:


final URL aboutFileURL = URLFactory.newFileURL(Ide.getHomeDirectory() + "extensions/skins/help.html");
HelpSystem.getHelpSystem().showHelp(aboutFileURL );

Then in your bundle.xml file for the extension you use the following attribute:

<u:post-startup-hook>package.yourclass</u:post-startup-hook>

That's it.

If you want to learn more about building extensions for JDeveloper check the Extension SDK page

Comments:

Hi Shay, nice extension, I noticed new skins and already tried. But I have experienced problem with those skins in FF 2.0: http://www.freewebalbum.com/demo/wc/wc.html p.s. am I aloud to use those skins without webcenter licence?

Posted by bjanko on February 19, 2007 at 07:04 PM PST #

You can use these skins without a webcenter license.

Posted by Shay Shmeltzer on February 20, 2007 at 05:20 AM PST #

Shay, The code you gave will only work if the extension if installed in the oracle home; but it will fail if installed in the users directory. I often do this so I don't have to reinstall extensions when I get a new build of JDeveloper. You can check out the source code for the jdev ant task and apsectj for a more reliable way of finding this file. Gerard

Posted by Gerard Davison on February 23, 2007 at 12:54 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today