JavaScriptDebuggerWebProject

Contents


Introduction

This document details the changes made to the Web Projects module to allow the JavaScript debugger to work with web projects. The intent of these changes is to enable an additional UI customizer and additional steps during a Debug action only when the JavaScript debugger modules are installed. The UI and overall design are detailed in the functional spec, found here.

Web Project Modifications

The modifications to the Web Projects module can be found in this hg changeset in the jsdebugger repository (06b1d650e1fe). These changes reside in two general areas: a Customizer implementation for the Debug category and the build-impl.xsl stylesheet to modify the debug target.

Debug Category Customizer

The Customizer is implemented in the Web Project module to allow access to the WebProjectProperties instance associated with the project. It sets the following properties:

  • debug.client - This property is set to true if the client (i.e. JavaScript) debugger should be invoked during a debug action.
  • debug.server - This property is set to true if the server-side debugger should be invoked during a debug action.

A third property, debug.client.available , is inserted into nbproject/private/private.properties through a ProjectOpenedHook . If this property is not set, the previous two properties are ignored by the build script.

This customizer is not defined in the Web Project module's XML layer, so by default the Customizer is not visible to the user when the Project Properties dialog is opened.

Build Script

There are several changes in the build-impl.xsl script to accommodate the JavaScript debugger. An additional macro is added for the JavaScript debugger Ant task. The three previously mentioned properties are used to enable and disable three parts of the debug action: invoking the jpda debugger, launching the browser, and invoking the JavaScript debugger. The logic for this is detailed below.

  • If debug.client.available is not set, then the server-side debugger and browser are enabled.
  • If debug.client is set to true, the browser launching is disabled (since the JavaScript debugger launches its own browser) and the JavaScript debugger is started.
  • If debug.server is set to true, the jpda debugger is started. The browser is launched if debug.client=false and display.browser=true .

Enabling JavaScript Functionality

The functionality is enabled through the layer file of one of the JavaScript debugger modules. Part of the layer definition is provided here:

    <folder name="Projects">
        <folder name="org-netbeans-modules-web-project">
            <folder name="Lookup">
                <file name="org.netbeans.modules.web.client.javascript.debugger.ant.NbJSDebuggerLookupProvider.instance"/>
            </folder>
            
            <folder name="Customizer">
                <file name="Debug.instance">
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.web.project.ui.customizer.WebCompositePanelProvider.createDebug"/>
                    <attr name="position" intvalue="550"/>
                </file>
            </folder>
        </folder>
    </folder>

The LookupProvider implementation adds a ProjectOpenedHook that inserts the debug.client.available property into nbproject/private/private.properties when the project is opened and removes the property when the project is closed. This ensures that the functionality is only enabled when the JavaScript debugger modules are present.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo