TechTip: Finding Method Definitions and Object Declarations in iRAD

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

IBM's Rational Application Developer (iRAD) IDE simplifies end-to-end development of Java, J2EE, Web, and portal applications. In this article, I will illustrate how you can easily find method definitions and object declarations.

You never have to search for these again. This is especially useful when you have many lines of code and multiple classes in your project. Another wonderful thing about this is that you can view not only classes, but also definitions of Java APIs. In the code snippet below (Figure 1), I have declared Button b and then invoked the addActionListener method on b. If I want to view the addActionListener method definition, all I have to do is highlight the method and then hit F3:
http://www.mcpressonline.com/articles/images/2002/Finding%20definitions_declarationsV4--10130600.png

Figure 1: Highlight the text and then hit F3. (Click images to enlarge.)

The Button class is immediately displayed with the desired method definition highlighted, as shown in Figure 2:

http://www.mcpressonline.com/articles/images/2002/Finding%20definitions_declarationsV4--10130601.png

Figure 2: The method definition is displayed after you hit F3.

As I mentioned, this feature can also be used to find object declarations. You might want to find out whether an object was initialized or what it was initialized to. In Figure 3, the contacts object is being used in the delete method of my class. If I hold the cursor over the object, I can tell that it is a vector:

http://www.mcpressonline.com/articles/images/2002/Finding%20definitions_declarationsV4--10130602.png

Figure 3: When the cursor hovers over the object, you can see the object type.

Now I want to know what the contacts object was initialized to. I need only select the object and hit F3. The declaration of this object is immediately displayed (as shown in Figure 4), and I can see that I had initialized it to a vector of size 100:

http://www.mcpressonline.com/articles/images/2002/Finding%20definitions_declarationsV4--10130603.png

Figure 4: The object declaration is displayed after hitting F3.

As we saw in the previous example, this feature works across classes as well so it is very useful when coding large projects.

More iRAD Tricks

For a long list of iRAD development tricks, click on Help -> Tips And Tricks in the menu bar. Happy coding!

Chinwe Edeani is a software engineer in IBM, Rochester, Minnesota. She joined IBM in 2004 after graduating from Michigan State University. She is now working in the Customer Solutions Test team. You can contact Chinwe at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$