I am new to extention creation in eclipse. I am trying to add same context menu to Project Explorer and Package Explorer.
XXX_label is menu and XXX, YYY and ZZZ are commands.
For project Explorer as described in Link, I added entry for project explorer and package Explorer.
Plugin.xml
<plugin>
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">
<menu
id="XXX_Project"
label="XXX_label">
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:XXX_Project?after=additions">
<command
commandId="demoeeeeeeeemenu.XXX"
id="XXX"
label="XXX"
style="push">
<visibleWhen>
<with
variable="activeMenuSelection">
<iterate
ifEmpty="true"
operator="or">
//Only option to get the Project instance in core expression is adapt type!!
<adapt
type="org.eclipse.core.internal.resources.Project">
</adapt>
</iterate>
</with>
</visibleWhen>
</command>
<command
commandId="demoeeeeeeeemenu.YYY"
label="YYY"
style="push">
</command>
<command
commandId="demoeeeeeeeemenu.ZZZ"
label="ZZZ"
style="push">
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:popup:org.eclipse.jdt.ui.PackageExplorer#PopupMenu?after=additions">
<menu
id="XXX_package"
label="XXX_label">
</menu>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:XXX_package?after=additions">
<command
commandId="demoeeeeeeeemenu.XXX"
label="XXX"
style="push">
</command>
<command
commandId="demoeeeeeeeemenu.YYY"
label="YYY"
style="push">
</command>
<command
commandId="demoeeeeeeeemenu.ZZZ"
label="ZZZ"
style="push">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="demoeeeeeeeemenu.XXX"
name="XXX">
</command>
<command
id="demoeeeeeeeemenu.YYY"
name="YYY">
</command>
<command
id="demoeeeeeeeemenu.ZZZ"
name="ZZZ">
</command>
</extension>
</plugin>
How to eliminate extra entry done by package explorer? Any of Help is Appreciated.
EDIT : I think it is better to use locationURI="popup:org.eclipse.ui.popup.any?after=additions" as single popup entry which will add menu entry in both package explorer, Project Explorer and Navigator.