Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Execute a command from code
Execute a command from code [message #327168] Sat, 12 April 2008 12:42 Go to next message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

HI,

guess I have a edit command on my view toolbar.
Now I want that command to be executed on a double click on the views
selection. Command.execute needs an ExecutionEvent, is there an
appropriate way to construct such Event ?

Thanks for helping me
Thomas
Re: Execute a command from code [message #327169 is a reply to message #327168] Sat, 12 April 2008 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

What I mean is that I only have the DoubleClickEvent that doesnt help.
How would you solve this ?

Thomas schrieb:
> HI,
>
> guess I have a edit command on my view toolbar.
> Now I want that command to be executed on a double click on the views
> selection. Command.execute needs an ExecutionEvent, is there an
> appropriate way to construct such Event ?
>
> Thanks for helping me
> Thomas
Re: Execute a command from code [message #327180 is a reply to message #327168] Sun, 13 April 2008 13:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

IHandlerService hs
= (IHandlerService) getSite().getService(IHandlerService.class);
hs.executeCommand("command.id", null);



--
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: Execute a command from code [message #327267 is a reply to message #327180] Tue, 15 April 2008 05:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

HI Paul,

I thought of that, but the handler needs a proper ExecutionEvent !

Paul Webster schrieb:
> IHandlerService hs
> = (IHandlerService) getSite().getService(IHandlerService.class);
> hs.executeCommand("command.id", null);
>
>
>
Re: Execute a command from code [message #327272 is a reply to message #327267] Tue, 15 April 2008 06:43 Go to previous message
Eclipse UserFriend
Originally posted by: tom.eiswind.de

Tried it works like a charm. Thought I needed an event !

Thomas schrieb:
> HI Paul,
>
> I thought of that, but the handler needs a proper ExecutionEvent !
>
> Paul Webster schrieb:
>> IHandlerService hs
>> = (IHandlerService) getSite().getService(IHandlerService.class);
>> hs.executeCommand("command.id", null);
>>
>>
>>
Previous Topic:Eclipse Forms and JFace Dialog
Next Topic:Composite preferred size
Goto Forum:
  


Current Time: Sun Jun 30 19:28:02 GMT 2024

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

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

Back to the top