Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Using Commands in custom Classes
Using Commands in custom Classes [message #325098] Fri, 08 February 2008 05:05 Go to next message
Eclipse UserFriend
Hi,

I've a self written menu inside a view. I want plug-ins to contribute to
this menu using the extension point ‘org.eclipse.ui.menu’ and
‘locationURI’. When starting the plug-in I want to read all plug-ins that
define such extension point and using a ‘locationURI’ matching my menu.

My question is, how can I get access a command properties? Since it’s a
custom menu, I've to get its label, description and image. Also, once the
menu is used I've to get access to its handler and execute it.

I could do this all by hand parsing extension points manually. But isn’t
there a more handy kind of way? Such like a helper API??

Thanks,
Jan
Re: Using Commands in custom Classes [message #325102 is a reply to message #325098] Fri, 08 February 2008 08:28 Go to previous messageGo to next message
Eclipse UserFriend
I've done it really complicated know. Had to parse it all by my self. :(
The next problem is, that commands names and descriptions, or menus labels
and tooltips my be provided using plugin.properties and '%*' labels.
When Asking the menus IConfigurationElement for its attribute 'label' it
returns '%xxx.yyy.zzz.' for instance. Do I really have to open the
corresponding plugin.propertie file and parse it afterwards all by my
self? C'mon, there must be handy tools for doing such stuff! Aren’t there?
*hope*

Thanks
Re: Using Commands in custom Classes [message #325107 is a reply to message #325098] Fri, 08 February 2008 10:12 Go to previous message
Eclipse UserFriend
Jan Kohnert wrote:
> Hi,
>
> I've a self written menu inside a view. I want plug-ins to contribute to
> this menu using the extension point ?org.eclipse.ui.menu? and
> ?locationURI?. When starting the plug-in I want to read all plug-ins
> that define such extension point and using a ?locationURI? matching my
> menu.

So you have a menu inside your view that's not a context menu
(getSite().registerContextMenu(*)) and not your view menu
(getActionBars().getMenuManager())? Both of those menus have well known
locationURIs.

If you create your own MenuManager for another menu, you can participate
in org.eclipse.ui.menus by using the IMenuService to populate your menu.
Simply pick a meaningful menu id, like: menu:your.view.id.special.menu

Then you can use IMenuService#populateContributionManager(*) to populate
your MenuManager with contributions to the
menu:your.view.id.special.menu locationURI

When your menu finally goes away, then you use
IMenuService#releaseContributions(*) to clean up contributions.


--
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:TableTreeViewer Additional Icon after [+][-]
Next Topic:Accessibility issue on Linux
Goto Forum:
  


Current Time: Sat Jul 12 19:01:17 EDT 2025

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

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

Back to the top