Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » eclipse 3.3 - problem attaching a command to a context menu using org.eclipse.ui.menus extension poi
eclipse 3.3 - problem attaching a command to a context menu using org.eclipse.ui.menus extension poi [message #319865] Tue, 04 September 2007 19:55 Go to next message
James Towers is currently offline James TowersFriend
Messages: 21
Registered: July 2009
Junior Member
Hi All,

I am having a problem attaching a command to a context menu using the
org.eclipse.ui.menus extension point. The command is not being shown on the
context menu of the editor. I was able to attach the command fine when I
specified menu:.... and toolbar:.... in the locationURI. Below is the xml
for the menus extension point. I would appreciate any help.

Thanks,
Jim

<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:#TextEditorContext?after=additions">
<menu
icon="icons/teamcenter_app_16.gif"
id="com.towers.contextmenu.menus.sampleMenu"
label="Sample Contect menu"
mnemonic="M">
<command
commandId="com.towers.contextmenu.commands.sampleCommand"
mnemonic="S"
id="com.towers.contextmenu.menus.sampleCommand">
</command>
</menu>
</menuContribution>
</extension>
Re: eclipse 3.3 - problem attaching a command to a context menu using org.eclipse.ui.menus extension [message #319870 is a reply to message #319865] Tue, 04 September 2007 22:26 Go to previous messageGo to next message
James Leotta is currently offline James LeottaFriend
Messages: 202
Registered: July 2009
Senior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello James,

I had the same problem until I registered a contextMenu within my view
with the following:

private void initializeMenu() {
MenuManager menuManager = new MenuManager("#PopupMenu");
Menu menu =
menuManager.createContextMenu(tableViewer.getControl());
tableViewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuManager, tableViewer);
}

It all worked fine after that but I don't know whether it is possible to
do popups using the menu extension alone without a registered
contextMenu or if so how to do it.

James Towers wrote:
> Hi All,
>
> I am having a problem attaching a command to a context menu using the
> org.eclipse.ui.menus extension point. The command is not being shown on the
> context menu of the editor. I was able to attach the command fine when I
> specified menu:.... and toolbar:.... in the locationURI. Below is the xml
> for the menus extension point. I would appreciate any help.
>
> Thanks,
> Jim
>
> <extension
> point="org.eclipse.ui.menus">
> <menuContribution
> locationURI="popup:#TextEditorContext?after=additions">
> <menu
> icon="icons/teamcenter_app_16.gif"
> id="com.towers.contextmenu.menus.sampleMenu"
> label="Sample Contect menu"
> mnemonic="M">
> <command
> commandId="com.towers.contextmenu.commands.sampleCommand"
> mnemonic="S"
> id="com.towers.contextmenu.menus.sampleCommand">
> </command>
> </menu>
> </menuContribution>
> </extension>
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3duW/vLG7sWn478RAi5QAJ47b2hLw5fOI4uAele0zMkFgz9PxwCf dzdd
QByteEz2JteHnK46xOj4gRE=
=ZsvL
-----END PGP SIGNATURE-----
Re: eclipse 3.3 - problem attaching a command to a context menu using org.eclipse.ui.menus extension [message #319873 is a reply to message #319870] Wed, 05 September 2007 01:55 Go to previous messageGo to next message
David Kyle is currently offline David KyleFriend
Messages: 125
Registered: July 2009
Senior Member
James,

You have to register a context menu before you can use the menu extension.

I've got a summary of resources for using the menu extension that should be
of help.

http://richclientplatform.blogspot.com/2007/07/new-menu-cont ribution-extension.html

David

"Jim Leotta" <jleotta@bascom.com> wrote in message
news:fbkm1d$dt9$1@build.eclipse.org...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello James,
>
> I had the same problem until I registered a contextMenu within my view
> with the following:
>
> private void initializeMenu() {
> MenuManager menuManager = new MenuManager("#PopupMenu");
> Menu menu =
> menuManager.createContextMenu(tableViewer.getControl());
> tableViewer.getControl().setMenu(menu);
> getSite().registerContextMenu(menuManager, tableViewer);
> }
>
> It all worked fine after that but I don't know whether it is possible to
> do popups using the menu extension alone without a registered
> contextMenu or if so how to do it.
>
> James Towers wrote:
>> Hi All,
>>
>> I am having a problem attaching a command to a context menu using the
>> org.eclipse.ui.menus extension point. The command is not being shown on
>> the
>> context menu of the editor. I was able to attach the command fine when I
>> specified menu:.... and toolbar:.... in the locationURI. Below is the
>> xml
>> for the menus extension point. I would appreciate any help.
>>
>> Thanks,
>> Jim
>>
>> <extension
>> point="org.eclipse.ui.menus">
>> <menuContribution
>> locationURI="popup:#TextEditorContext?after=additions">
>> <menu
>> icon="icons/teamcenter_app_16.gif"
>> id="com.towers.contextmenu.menus.sampleMenu"
>> label="Sample Contect menu"
>> mnemonic="M">
>> <command
>>
>> commandId="com.towers.contextmenu.commands.sampleCommand"
>> mnemonic="S"
>> id="com.towers.contextmenu.menus.sampleCommand">
>> </command>
>> </menu>
>> </menuContribution>
>> </extension>
>>
>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFG3duW/vLG7sWn478RAi5QAJ47b2hLw5fOI4uAele0zMkFgz9PxwCf dzdd
> QByteEz2JteHnK46xOj4gRE=
> =ZsvL
> -----END PGP SIGNATURE-----
Re: eclipse 3.3 - problem attaching a command to a context menu using org.eclipse.ui.menus extension [message #319899 is a reply to message #319865] Wed, 05 September 2007 15:13 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

James Towers wrote:
> Hi All,
>
> I am having a problem attaching a command to a context menu using the
> org.eclipse.ui.menus extension point. The command is not being shown on the
> context menu of the editor.

I plugged your XML into a plugin and it showed up in the text editor
context menu fine.

Are you writing your own editor? (other posters have given advice about
registering a context menu).

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: eclipse 3.3 - problem attaching a command to a context menu using org.eclipse.ui.menus extension [message #319911 is a reply to message #319899] Wed, 05 September 2007 16:26 Go to previous message
James Towers is currently offline James TowersFriend
Messages: 21
Registered: July 2009
Junior Member
Hi Paul,

I am not writting my own editor so I didn't register a context menu.

I plugged the XML into a different plug-in after I saw your reply and I also
saw the context menu fine. I went back to my initial plug-in and noticed
that I was refering to an invaild command id in the command element inside
the menu element. I fixed that and all worked well there also.

I appreciate all the replies and information.

Thanks,
Jim

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:fbmgko$tjq$1@build.eclipse.org...
> James Towers wrote:
>> Hi All,
>>
>> I am having a problem attaching a command to a context menu using the
>> org.eclipse.ui.menus extension point. The command is not being shown on
>> the context menu of the editor.
>
> I plugged your XML into a plugin and it showed up in the text editor
> context menu fine.
>
> Are you writing your own editor? (other posters have given advice about
> registering a context menu).
>
> Later,
> PW
>
> --
> Paul Webster
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
> http://wiki.eclipse.org/Menus_Extension_Mapping
> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:Eclipse WebStart (non-RCP)
Next Topic:Documentation for contributed ANT tasks
Goto Forum:
  


Current Time: Fri Jul 12 10:30:48 GMT 2024

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

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

Back to the top