Visual Age Java Tips

VisualAge Java is a large program with features that many people don't think to exploit (some of these features come from its Smalltalk heritage, and if you haven't used Smalltalk its easy to miss them).

The following are some tips that I've noticed new users often miss -- TimMackinnon

In a debugger you can swipe any expression, right click and pick Inspect. It will evaluate the expression and give an inspector (great if you want to see what that 'if' expression is going to do before you step over it - if its wrong you can step inside and see why).

When you get an inspector on an object you can type any expression in the right pane, and swipe it and evaluate that as well. E.g. inspect a date, and then type this.getTime() and inspect that. If you select an attribute, this runs in the context of that attribute (this is all very similar to what you can do in a scrapbook however you have to set the context of the scrapbook using Run In ).

Don't forget to try Ctrl-L for code completion. E.g. type: Date.g(type Ctrl-L now). Unfortunately this doesn't work in the Class pane (bummer as this would be great for import statements, however I am told they ran out of time to finish this). You can also use ctrl-space to access code completion.

Drop stack frame in the debugger is great way for re-running a method from the start again. You can also drop to further back in the call stack as well.

er, have the people that made the above laudatory comments about VAJ's debugger ever seen a good C/C++ debugger (or FORTRAN, or...)? These features are ones I'd expect to see in any halfway good source level debugger, and certainly any in an IDE

Yes - and I've seen users forget to use these features in those debuggers as well -- Tim

Remember you can correct code in the debugger and save, this will then re-run the method from the start (it may start further down the call stack if the change has a large impact on the class).

This is a really useful feature

In the workspace menu, the "Open Type Browser" is a useful way of looking up classes and the packages they are in (and it takes wildcards as well). Unfortunately you can't copy the results - but you can open the window and copy the name. Also using Reorganize | Copy - is a quick way to get a package name so that you can copy it to the clipboard using Ctrl-C.

Unfortunately VisualAge Java doesn't have a unified repository (yet) - so when exporting code (in repository format so that you get version numbers and users) its easy to forget project resources (which are located in the project_resources directory in project based subdirectories). A workaround to exporting is to export your code into your project resources project directory (into a subdirectory called "drops"). Then export a second time, but this time use the Jar format, however only export the resources (no class or java files). This will neatly bundle up your resources and .dat file into a compressed jar you can send to a remote site. They reverse the process by importing the resources (however do this in the context of the project your are working on) and then importing the new drop. The caveat here, is that the first time you import there is no project in your environment, so you have to use something like WinZip? to extract the drops file and import it first. After this however, its a real time saver (until we get a unified repository).


Another nice one is the automagic code formatting accessed via ctrl-w. It's particularly helpful if you need to read imported code written by somebody who didn't care about indenting code properly. --PeterGassmann


If you are renaming a method or adding/deleting parameters, type ctl-shift-s. This will replace the old method with the new one. Then go fix all the problems.


The Window->Debug->Caught Exceptions window is way, way cool. If you are using JUnit, you can cause the debugger to pop up when there is an AssertionFailedError? (or any other exception).


When versioning and releasing, it may be easier to work via the Management Query tool (from the Workspace menu). The UI is pretty bad, but you can list all the open editions in one place and version them, and then list all the unreleased things and release them. --SteveFreeman


Nobody has mentioned (probably because everyone here has used smalltalk and finds everything else unimpressive) that you can right-click a method name and choose "references" from the pop-up menu, and get a list of the methods that call it. Speaking as someone who hasn't had that feature before, I find it unspeakably cool.

Hmmm...well, except that it apparently looks only at *source*, not at the bytecodes (as the Smalltalk flavor does). This means that you can't see consumers of your code unless you have their source. For example, you can't click on a method like "someClass.doSomething" and see how it is used by the package that defines it unless you have the source. -- TomStambaugh

Yes, well, we all already knew that Java (regardless of development environment) isn't as good as Smalltalk. So that's not surprising. It's still better than anything I had before.


Anyone know where the ToolAPI is documented? I found a PDF file but it doesn't go into depth on the API itself. I am desparately looking for this information, please help...

Was this the 'Tool Integrators for ISVs' file? I got hold of it today from the VisualAge Developer Domain, it talks about two packages in the "IBM IDE Utility class libraries" project contained in the repository. Although the project needs adding to the workspace after installation. Not had a chance to look at them yet, but hopefully the source code won't be too cryptic.

If you have a copy (including the free ones, I believe) the javadocs are in the help pages.


At the bottom of most browsers (windows) the name of the owner of the class appears. If you are trying to manage code where you are not the package or project owner this rapidly speeds up versioning (since you don't have to go and change the Workspace owner from a pick list). --KevinDriedger


Here's a neat one found today: You can multiselect the variables on the left hand side of an inspector and you will see them all AT THE SAME TIME on the right. i.e.

 x     |  12
 y     |  45
 width |  400
 height|  500
--KevinDriedger


Similar to another tip: you can open an evaluation area (Debugger>>Window>>Evaluation Area) for inspecting various results. You can do this in an inspector but the inspectors go away after exit the applet that you were debugging but the evaluation area keeps its text saved. --KevinDriedger


If you have created a class and forgot to put the accessors in the class at the same time, you can _after the fact_ generate the accessors:

  1. Select the class in any browser
  2. Bring up the popup menu>>Generate>>Accessors
--KevinDriedger


Anyone using Perforce with VisualAge? -- JohnBrewer


In VisualAge Java 3.02 (probably 3.0 and possibly 3.5??), you cannot put a breakpoint in the middle of an inner class. I wanted to debug an inner class I was working on and I found that:

  DebugSupport.halt()
works!!!

-- Same goes for breakpoints within a separate Thread - VA accepts breakpoints, though it doesn't stop. The solution's the same: just put a com.ibm.uvm.tools.DebugSupport.halt() into the sourcem which then will run the debugger - greg


VisualAge has version control down on the method level. Open up any method, make a change, save/compile. Repeat this a few times. The repository contains all in-between edits, and you can easily switch backwards and forwards betwen them, by selecting "replace with another edition" from the method-popup... The key to enjoying VisualAge is understanding version control. --ErikMogensen?


See also: VisualAgeJavaTidbits


See also: VisualAgeJavaGripes


EditText of this page (last edited April 24, 2001) or FindPage with title or text search