Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Menu imple be a code
Menu imple be a code [message #665752] Fri, 15 April 2011 14:03 Go to next message
ash is currently offline ash
Messages: 142
Registered: July 2010
Senior Member
Hi,

How to read menu extension point programtically
and add this as view menu bar..... i,e via code

Note all are command handler not Action

in the Same fashion how we use actionbar or actionset

thanks
Ashok

<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="menu:com.jobsleaf.myview">
<command
commandId="com.jobsleaf.command.displaydata"
label="Display"
mnemonic="n"
style="push">
</command>
<command
commandId="com.jobsleaf.command.print"
label="Print"
style="push">
</command>
</menuContribution>
</extension>
Re: Menu imple be a code [message #665761 is a reply to message #665752] Fri, 15 April 2011 14:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

If you create your own MenuManager for some reason, you can fill it in
just the same as the main menu bar by getting the IMenuService and then
using populateContributions on the manager, with the locationURI you want.

PW

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


Re: Menu imple be a code [message #665794 is a reply to message #665761] Fri, 15 April 2011 21:45 Go to previous messageGo to next message
ash is currently offline ash
Messages: 142
Registered: July 2010
Senior Member
HI,

How to add command handler to the menumanager because

Menumanager has add method which accept action has input it will not accept command handler...

IMenuService menuservice = (IMenuService)PlatformUI.getWorkbench().getActiveWorkbenchWi ndow().getService(IMenuService.class);
ICommandService commadnService = (ICommandService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getServ ice(ICommandService.class);
Command cmnd = commadnService.getCommand("com.jobsleaf.comman.display");
MenuManager menumgr = new MenuManager();

/// how can i add command to menu manager

menuservice.populateContributionManager(menumgr,"menu:com.ericsson.properties.view.view4 ");


Please help me i am half the way of the problem

Thanks
Ashok

[Updated on: Fri, 15 April 2011 22:03]

Report message to a moderator

Re: Menu imple be a code [message #665795 is a reply to message #665752] Fri, 15 April 2011 22:14 Go to previous messageGo to next message
ash is currently offline ash
Messages: 142
Registered: July 2010
Senior Member
Can u please look into this ur also


http://www.eclipse.org/forums/index.php?t=msg&th=207760& amp;start=0&S=c1c24ff1d380427bb1a218b47644e4f8

http://www.eclipse.org/forums/index.php?t=msg&th=207594& amp;start=0&S=c1c24ff1d380427bb1a218b47644e4f8

http://www.eclipse.org/forums/index.php?t=msg&th=206041& amp;start=0&S=c1c24ff1d380427bb1a218b47644e4f8
Re: Menu imple be a code [message #665964 is a reply to message #665794] Mon, 18 April 2011 07:28 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

On 04/15/2011 09:45 PM, ash wrote:
> HI,
>
> How to add command handler to the menumanager because
> Menumanager has add method which accept action has input it will not
> accept command handler...

You can either use IMenuService to populate your MenuManager from the
org.eclipse.ui.menus extension point, or you can simply add
CommandContributionItems (construct them with
CommandContributionItemParameter).

PW


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


Previous Topic:ViewPart closing - causing content provider to be disposed
Next Topic:remove Finsh button From Wizard Dialog
Goto Forum:
  


Current Time: Wed Apr 16 06:53:02 EDT 2014

Powered by FUDForum. Page generated in 0.01969 seconds