From the Desk of Oracle ACE Director

Chris Muir

Subscribe to Chris Muir: eMailAlertsEmail Alerts
Get Chris Muir: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Java EE Journal, Oracle Journal, Java Developer Magazine

Blog Feed Post

JDev 11gPS1 – Java Editor 'Declaration Insight'

If you're using JDev11gPS1 you've probably already stumbled upon this feature and not realized it

The JDev11gPS1 New Features page lists a large amount of improvements, including something called the "Declaration Insight". The New Features blurb lists this feature as "When declaring local variables from method calls, declaration insight can automatically add the declaration and assignment code as well as completing the method call."

Like us, if you're using JDev11gPS1 you've probably already stumbled upon this feature and not realized it.

You'll be familiar with the traditional Completion Insight. Say in an EntityImpl you're implementing a method and within you want to call the super class method to get the database transaction. However you've forgotten the function name, is it getDBTransaction or getDatabaseTransaction? This is easily solvable by starting to type the function name "getD" then activating Completion Insight, either via pressing Ctrl-Space or the Source menu's same named option. The editor will show the Completion Insight popup in blue with all the functions starting with "getD" in the super class stack, including the method we’re interested in getDBTransaction:

Selecting the same named method, the method is instantly copied into the code:

...saving you some typing and hunting around for the right method.

However the Completion Insight only really gives the right hand side of the assignment expression. It would be good if you could get the IDE to create the left hand side of the assignment expression creating a variable of the correct type to take the result from the function, as well as the function call on the right hand side of the assignment operator as per what the Completion Insight does.

This is where the new "Declaration Insight" comes in. On invoking the Completion Insight with Ctrl-Space showing itself in blue, if you press Ctrl-Space again you'll see the popup changes to puce and displays the very similar Declaration Insight:

Again selecting the same named method, using the Declaration Insight the result is:

....where both the function call and the variable to be assigned the result are inserted into your code, ultimately saving you a bit more typing. If you're like me, and always forgetting what the return type is by the time you're back to the editor, and having to hunt for it again by double invoking the Completion Insight, this will same some extra time.

A minor but useful enhancement in the latest JDev11gPS1 release.

Read the original blog entry...

More Stories By Chris Muir

Chris Muir, an Oracle ACE Director, senior developer and trainer, and frequent blogger at http://one-size-doesnt-fit-all.blogspot.com, has been hacking away as an Oracle consultant with Australia's SAGE Computing Services for too many years. Taking a pragmatic approach to all things Oracle, Chris has more recently earned battle scars with JDeveloper, Apex, OID and web services, and has some very old war-wounds from a dark and dim past with Forms, Reports and even Designer 100% generation. He is a frequent presenter and contributor to the local Australian Oracle User Group scene, as well as a contributor to international user group magazines such as the IOUG and UKOUG.