I'm trying to create a mock menu for a module of my netbeans platform project (which I'm starting).
I want to create a new entry "New" in "File" that would have "New Project" and "New Module".
In Important Files -> Xml Layer -> this layer in context -> Menu Bar -> File I've created a new folder "New", and it displays as it should.
Then I've added two empty files, "New Project" and "New Module", but they don't show.
Here's layer.xml:
<?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"/>
</folder>
<folder name="Menu">
<folder name="File">
<folder name="New">
<file name="New Module" url="New Module_2">
<attr name="requireProject" boolvalue="false"/>
<attr name="position" intvalue="800"/>
</file>
<file name="New Project" url="New Project_3">
<attr name="requireProject" boolvalue="false"/>
<attr name="position" intvalue="600"/>
</file>
</folder>
</folder>
</folder>
</filesystem>
I've deleted and created these files several times, hence the suffixes. The only thing I've added is positions.
I guess I'm either missing something or I misinterpreted something. I've read the documentation, but cannot find the answer.
So, how do I add and display a Menu Item?
I think that your <file name
should point to instances of Action. For example:
<file name="org-netbeans-core-actions-SystemExit.shadow">
<attr name="originalFile" stringvalue="Actions/System/org-netbeans-core-actions-SystemExit.instance"/>
<attr name="position" intvalue="2600"/>
</file>
From NetBeans documentation:
The main menu of the application is composed by reading Menu/ folder in the layer. A sub folder is treated as a sub menu. Instances of individual files (usually .instance or .shadow) may then represent Action or JMenuItem or JSeparator.
source: http://bits.netbeans.org/dev/javadoc/layers.html
Also here: http://wiki.netbeans.org/DevFaqSystemFilesystem
You can easily create actions with the wizard.