This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 204265

Summary: JavaHelp Helpset wizard does not add appropriate entries to module layer.xml for standalone platform application
Product: platform Reporter: jhuber
Component: Help SystemAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: normal Keywords: PLATFORM
Priority: P3    
Version: 7.0.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description jhuber 2011-10-26 11:42:55 UTC
Product Version = NetBeans IDE 7.0.1 (Build 201107282000)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_16
Runtime = Java HotSpot(TM) Client VM 14.2-b01

Steps to reproduce problem:

1. Create a new NetBeans platform application. 
2. Use the appropriate wizard to create/add a module to the application. 
3. Use the appropriate wizard to add a TopComponent to the new module. Have the TopComponent open with the application in the editor position. Add a JTextField to the top component
4. Use the appropriate wizard to add a JavaHelp Helpset to the module. Optionally add some text to the body of the newly created "-about.html" file to help identify your help set. 
5. Add the following code to the TopComponent: 
@Override 
public HelpCtx getHelpCtx() { 
    String xx = ""; 
    return new HelpCtx(xx); 
} 

6. Set a breakpoint in the above method. 
7. Debug the application. 
8. Go to the menu "Help | Help Contents" to display your helpset. It will be there and work fine. 
9. Click in your TopComponent and click in the JTextField to give it focus. 
10. Press "F1". Nothing happens. getHelpCtx is not called, and the breakpoint is not reached. 

To fix the problem, add the following code to layer.xml for the module created above:

   <folder name="Shortcuts"> 
        <file name="F1.shadow"> 
            <attr name="originalFile" stringvalue="Actions/Help/org-netbeans-modules-javahelp-HelpAction.instance"/> 
        </file> 
    </folder> 

Pressing F1 will now cause getHelpCtx() to fire, and the breakpoint is reached.

This issue has verified by users of 7.0.1 on forums.netbeans.org.

As the documentation indicates that F1 activates help (like the link http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-javahelp/org/netbeans/api/javahelp/doc-files/api.html), it would seem that the add helpset wizard should add the above necessary code to generate an F1-Help key mapping if it is not already present. That doesn't appear to be happening.  Apparently, when creating a standalone platform application, the exclusion of certain modules relative to the IDE leaves out the above necessary code to create the F1-Help key mapping.

Or, at a minimum, the documentation should be updated to indicate that the above code needs to be added to the layer.xml file for modules used in standalone platform applications.
Comment 1 Jesse Glick 2011-10-26 17:02:57 UTC
True; the shortcut was registered in org.netbeans.modules.defaults, in the ide cluster. This is a general problem of where to register default UI elements: in the module defining the element, or in a higher-level UI registration module? For this case I think the former answer is better.
Comment 2 Jesse Glick 2011-10-26 17:08:18 UTC
core-main #47f87730d233
Comment 3 Quality Engineering 2011-10-27 14:05:45 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/47f87730d233
User: Jesse Glick <jglick@netbeans.org>
Log: #204265: JavaHelp Helpset wizard does not add appropriate entries to module layer.xml for standalone platform application