Search code examples
javanetbeansrich-client-platform

Moving IDE Log menu item in NetBeans RCP


How can we move menuitem "IDE Log" of NetBeans RCP from "View" menu to other menu ?


Solution

  • Hiding existing menu

    1. Use the layer.xml file (add if not there) and _hidden suffix to hide the required menu
    2. Refer the answer https://stackoverflow.com/a/10291239/446251 for detailed explanation

    Adding menu like existing menu

    1. Note the action class for the current menu in the layer file
    2. Add your own menu where needed and set the action class to the earlier noted action

    Example Layer file

    <filesystem>
    <folder name="Menu">
        <folder name="View">
            <file name="Separator2.instance_hidden"/>
            <file name="org-netbeans-core-actions-LogAction.shadow_hidden"/>
        </folder>
        <folder name="Other">
            <file name="org-netbeans-core-actions-LogAction.shadow">
                <!--org.netbeans.core.actions.LogAction-->
                <attr name="originalFile" stringvalue="Actions/View/org-netbeans-core-actions-LogAction.instance"/>
                <attr intvalue="500" name="position"/>
            </file>
        </folder>
    </folder>
    </filesystem>
    

    Example Project code You can check the bare minimum NetBeans Platform application here https://archive.org/download/application1_201601/application1.zip