Source View

The source view displays Java source code in a scrollable text area. The source views are opened automatically when a breakpoint is hit and while single-stepping through code, such that the current point of execution is displayed. Source views can be opened manually using the "Open File" menu item in the "File" menu, which presents a file open dialog for locating and selecting a source file to display. Additionally, the classes panel may be used to view source for a particular class. Simply double-click on the desired method under the name of the class you want to view.

Parser Errors

If the source view attempted to parse the source code as Java language code and encountered an error, the error line is highlighted in red. Moving the mouse pointer over the line should show a tooltip that contains the parser error message. The message may be preceded by a pair of numbers. The first value is the line number and the second is the column number (both one-based) where the error was found.

The Gutter

The gutter is the place where the line numbers are shown, on the left side of the source view. The background color is used to indicate the location of breakpoints. The default light gray indicates that line does not have a breakpoint. The other colors are defined as follows:

Red
Expired; hit count reached 'expire count'.
Gray
Disabled by user.
Blue
Unresolved; waiting for class to load.
Yellow
Skipping hits until 'skip count' is reached.
Green
Ready to be hit.

In addition to indicating breakpoint status, the gutter may be used to set breakpoints. By clicking the mouse in the gutter during an active session (Sessions), you can create a breakpoint where one does not exist, disable it if one does exist, or remove it if it is already disabled. That is to say, clicking on the same line three times will: create the breakpoint, disable the breakpoint, and finally remove the breakpoint.

Current Location

The current location is like the current thread (see Threads, Call Stack). It is set whenever a breakpoint is hit and indicates the line about to be executed in the debuggee. The line is indicated in the source view using a blue highlight across that line. Changing the current thread or stack frame will move the highlight to the corresponding line of the appropriate source view.

Refreshing

The source views are automatically refreshed whenever a debugging session is started (either by attaching to a remote debuggee or launching a debuggee). Additionally, the views may be manually refreshed using the "Refresh" button in the toolbar, or the "Refresh Display" menu item in the "View" menu.

Searching

You can search for words and phrases in the source view by using the "Search Source" menu item in the "View" menu (or the toolbar button with the binoculars). In the Find dialog, simply enter the word or phrase you are looking for, then click Ok. To ignore letter casing, select the checkbox provided. The search phrase is actually a regular expression, although any simple word or phrase will work. See the JDK documentation for the java.util.regex.Pattern class to learn about the supported features.

Options

There are a number of options affecting the view, which include the following. They are specified in the "Options" submenu of the "Options" menu.

Colorize
This enables or disables the use of a Java lexical analyzer to determine the locations of all of the tokens in the source file. This information, when enabled, is used to colorize the source code. You may want to disable this if you usually view files that are not Java source code.
Parse as Java
This enables or disables the use of a Java language parser to determine the locations of all of the classes and methods in the source file. This information, when enabled, is used to set breakpoints and scroll to method definitions. You may want to disable this if you usually view files that are not Java source code.
Maximize
When enabled, the source view windows will be maximized when they are first opened.

Launching External Editor

The source view popup menu contains an item labeled "Open in editor". When this item is selected, the program specified in the "External source editor" field of the "Source View" user preferences category is launched. The "%f" in the command string is replaced with the full path of the source file. The "%l" is replaced with the line number on which the source view popup was invoked.

The external editor is executed via the Runtime.exec() method. If the Java VM cannot find the editor as specified, you must either set your program path appropriately, or specify the full path to the editor executable.