Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to properly register context submenu
How to properly register context submenu [message #466588] Sat, 21 April 2007 23:36 Go to next message
Eclipse UserFriend
Originally posted by: jweeks.neuraldk.org

Hello,

I'm attempting to add a submenu to my editors context menu. I'm using the
xml below to define the menu, and it appears correctly, but does not
operate (returns an error dialog "The chosen operation is not currently
available").

<extension point="org.eclipse.ui.popupMenus">
<viewerContribution
id="org.eclipse.ui.articles.action.contribution.popup.editor "
targetID="#TextEditorContext">

<menu
id=" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu "
label="Highlight"
path="additions">
<separator name="highlightGroup"/>
</menu>

<action
id=" org.eclipse.ui.articles.action.contribution.navigator.highli ghtBlue "
label="Blue"
icon="icons/sample.gif"
menubarPath=" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu/highlightGroup "
class="tvnavtraceviewer.actions.HighlightAction">
</action>
</viewerContribution>
</extension>

From what I can tell, this is because it's not associated with a selection
provider, but I haven't been able to properly make this association.

I realize I should be using the 'registerContextMenu' method, but I don't
understand what I should be using for parameters. I believe I have
everything correct below, aside from the MenuManager instance... how should
I be getting and/or creating this instance?

this.getEditorSite().registerContextMenu(
" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu ",
new
MenuManager(" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu "),
getEditorSite().getSelectionProvider());

Thanks,
Jeff
Re: How to properly register context submenu [message #466596 is a reply to message #466588] Sun, 22 April 2007 17:55 Go to previous message
Eclipse UserFriend
Originally posted by: jweeks.neuraldk.org

It turns out that my implementation class had to implement the
IEditorActionDelegate interface. I don't understand why, though, as I
haven't had to implement this interface for my other context menu items.

--Jeff


Jeff Weeks [ neuraldk ] wrote:

> Hello,
>
> I'm attempting to add a submenu to my editors context menu. I'm using the
> xml below to define the menu, and it appears correctly, but does not
> operate (returns an error dialog "The chosen operation is not currently
> available").
>
> <extension point="org.eclipse.ui.popupMenus">
> <viewerContribution
> id="org.eclipse.ui.articles.action.contribution.popup.editor "
> targetID="#TextEditorContext">
>
> <menu
>
id=" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu "
> label="Highlight"
> path="additions">
> <separator name="highlightGroup"/>
> </menu>
>
> <action
>
id=" org.eclipse.ui.articles.action.contribution.navigator.highli ghtBlue "
> label="Blue"
> icon="icons/sample.gif"
>
menubarPath=" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu/highlightGroup "
> class="tvnavtraceviewer.actions.HighlightAction">
> </action>
> </viewerContribution>
> </extension>
>
> From what I can tell, this is because it's not associated with a selection
> provider, but I haven't been able to properly make this association.
>
> I realize I should be using the 'registerContextMenu' method, but I don't
> understand what I should be using for parameters. I believe I have
> everything correct below, aside from the MenuManager instance... how
> should I be getting and/or creating this instance?
>
> this.getEditorSite().registerContextMenu(
> " org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu ",
> new
>
MenuManager(" org.eclipse.ui.articles.action.contribution.navigator.highli ghtMenu "),
> getEditorSite().getSelectionProvider());
>
> Thanks,
> Jeff
Previous Topic:access other plugins (without dependeny)
Next Topic:Adding button to ListSelectionDialog
Goto Forum:
  


Current Time: Tue Apr 16 04:31:47 GMT 2024

Powered by FUDForum. Page generated in 0.12908 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top