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 253214

Summary: Keymap options has duplicate menu items in "File" category
Product: editor Reporter: tdanard
Component: Key bindingsAssignee: Svata Dedic <sdedic>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description tdanard 2015-06-26 19:19:16 UTC
I find that the Tools -> Options -> Keymap panel has duplicate entries for every one of my entries in the "File" category. If I assign a shortcut through the panel, that shortcut will immediately show for both entries.

Other categories (View, Windows, etc) don't have duplicates. 

Here is a sample registration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
    <folder name="Actions">
        <folder name="File">
            <file name="com-mycompany-mypackage-MyAction.instance">
                <attr name="position" intvalue="201"/>
            </file>
        </folder>
    </folder>
    <folder name="Menu">
        <folder name="File">
            <attr name="position" intvalue="100"/>
            <file name="com-mycompany-mypackage-MyAction.shadow">
                <attr name="originalFile" stringvalue="Actions/File/com-mycompany-mypackage-MyAction.instance"/>
                <attr name="position" intvalue="201"/>
            </file>
        </folder>
    </folder>
</filesystem>

When I tried to do this with a virtually empty/new platform application, I don't encounter this issue. I do not know which other configuration item triggers this situation.

I also find that if I add this:

    <folder name="Keymaps">
        <folder name="NetBeans_hidden">
        </folder>
         <folder name="MyKeyMaps">
        </folder>
    </folder>

The "MyKeyMaps" profile will show, but none of the shortcuts I enter will work. They do otherwise.

Both issues prevent me from reusing the "Keymap" panel in my application.
Comment 1 tdanard 2015-07-06 21:36:30 UTC
The duplicate actions issue was due to an "Actions" folder titled "File Shortcuts". Once I removed this folder, the problem went away.

The NetBeans code attempts to detect and remove duplicate actions, but it is "optimized" to look at the last action only. This optimization was not designed for the case where an "Actions" folder starts with the same name as a category.
Comment 2 Theofanis Oikonomou 2015-09-11 14:40:38 UTC
re-assigning as I am not familiar with the keymaps internals. Please evaluate. Thank you for reporting.
Comment 3 Svata Dedic 2016-01-29 16:15:17 UTC
(In reply to tdanard from comment #1)
> The duplicate actions issue was due to an "Actions" folder titled "File
> Shortcuts". Once I removed this folder, the problem went away.
> 
> The NetBeans code attempts to detect and remove duplicate actions, but it is
> "optimized" to look at the last action only. This optimization was not
> designed for the case where an "Actions" folder starts with the same name as
> a category.

Sorry I don't entirely understand; could you elaborate a bit ? Thanks.
Comment 4 Svata Dedic 2016-08-12 12:46:42 UTC
Can't reproduce, no respnse from the reporter for 6 months