2: Links to Source Code

The Gild Web Browser allows, by the use of specialized HTML tags, a web page to link source the web content to source code in the workspace. The links look like regular html links. But when they are selected, instead of navigating to another web page, the source code reference will be openned inside an editor within Eclipse. The referenced code will be highlighted in the editor.

Below is an example of a page rendered with such a link, and the HTML source that created that link:

    <p>You may go look at the code directly by selecting this link:
    <a href=
        'javascript:liveAction(
        "ca.uvic.gild.docs",
        "src/Loops.java",
        "Loops.forLoop()"
        )'
>to the code </a>.</p>

The link works by using a specialized JavaScript function called liveAction. liveAction has three parameters, the last of which is optional.
Project: The name of the project in which the Java source code is contained. The project must be openned in the workspace, and it must be a Java project. The word null (with no quotation marks) can be used to represent "the same project in which this HTML file is contained".
File: The name of the file that contains the Java source code. This may be a *.java file (for full Java source) or a *.jpage file (for Java snippets). The name must include the entire path of the file, relative to the project in which it is contained.
Method Signature: An optional method signature. It is of the form Container.method(parameter1,parameter2,...). Where Containeris the name of the class or interface that contains the method, method is the method name, and parameter1,parameter2,... are the parameters of the method. You need only to specify the variable types for the parameters, but variable names may be included as well. For example, Container.main(String[] args), and Container.main(String[]) are equivalent. If the Method Signature parameter is ommitted, then an editor will be openned, but the entire text of the reference Java source file will be selected, not just a single method. This parameter is ignored for *.jpage files, and so should normally be ommitted.