Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Possible with commands?
Possible with commands? [message #480765] Tue, 18 August 2009 12:36 Go to next message
Christian is currently offline ChristianFriend
Messages: 72
Registered: July 2009
Member
Hello Group,

with my basic knowledge of core commands api I recently stood before a
wall. Not knowing how to do this..

Folowing problem ..
I have in my Model an Object linking to several owners (User objects)

is it possible to create in a Popup menu (more precisely in a submenu in
a popupmenu)

one entry for each user of the file.

So I imagine a submenu called "Send message"
and in it one entry for each user named after the user i.e. user.getName();

Would that scenario be possible with commands and handlers (how?) or do
I have to use actions for this?

Christian
Re: Possible with commands? [message #480827 is a reply to message #480765] Tue, 18 August 2009 15:34 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You would do something similar to the Window>Show View menu. Use a menuContribution to contribute a dynamic element, a subclass of org.eclipse.ui.actions.CompoundContributionItem. You can implement org.eclipse.ui.menus.IWorkbenchContribution if you need to get any services.

Your command to send mail would take an optional parameter, i.e. com.example.sendMail would have a parameter named com.example.sendMail.email. A static menu contribution might look like:

<command id="send.paul" commandId="com.example.sendMail"
label="Send: Paul">
<parameter name="com.example.sendMail.email" value="pwebster@example.com"/>
</command>


When asked for the contribution items, you would be generating CommandContributionItems from an CommandContributionItemParameter similar to org.eclipse.ui.internal.ShowViewMenu.getItem(String)

PW


Previous Topic:How To Hide Resources From The Package Explorer After Creating Them
Next Topic:try without catch. A Bug?
Goto Forum:
  


Current Time: Sat Apr 20 02:57:21 GMT 2024

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

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

Back to the top