Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to use Command and Handler concept for SWT Widget. (How to use Command and Handler concept for SWT Widget. )
How to use Command and Handler concept for SWT Widget. [message #990598] Thu, 13 December 2012 11:40 Go to next message
sumit singh is currently offline sumit singhFriend
Messages: 139
Registered: October 2012
Location: Bangalore
Senior Member

I'm creating one RCP in Eclipse 4.2. My question is like for each menu and toolbar we can use command and handler concept is there is any slandered way to use command and handler concept for SWT component of any part.

Like if i have a part in that part i created 1 button and i want to call a command when it'll click. So except executing command inside action, do we have any other way so that like menu we can resister our command for particular button or may be for others widget.

Thanks.

[Updated on: Thu, 13 December 2012 12:07]

Report message to a moderator

Re: How to use Command and Handler concept for SWT Widget. [message #990953 is a reply to message #990598] Sat, 15 December 2012 11:16 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 194
Registered: January 2012
Senior Member

You can obtain the ICommandService and IHandlerService and use them to execute the command. Or use JFace's MenuManager and the CommandContributionItem to manage the menus.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to use Command and Handler concept for SWT Widget. [message #991021 is a reply to message #990953] Mon, 17 December 2012 05:22 Go to previous messageGo to next message
sumit singh is currently offline sumit singhFriend
Messages: 139
Registered: October 2012
Location: Bangalore
Senior Member

I think your are talking about following.
Command command = iCommandService.getCommand("your command");
final Event trigger = new Event();
ExecutionEvent executionEvent = iHandlerService.createExecutionEvent(command, trigger);
try {
	command.executeWithChecks(executionEvent);
} catch (Exception e1) {
	e1.printStackTrace();
}	


If yes than that i know , What i want is like in case of menu and toolbar we just resister the command . like that is there is any way to do same for button and all in Part GUI.
Re: How to use Command and Handler concept for SWT Widget. [message #991079 is a reply to message #991021] Mon, 17 December 2012 10:05 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 194
Registered: January 2012
Senior Member

Certainly nothing that I'm aware of -- that code snippet you included is it.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: How to use Command and Handler concept for SWT Widget. [message #991114 is a reply to message #991079] Mon, 17 December 2012 12:01 Go to previous message
sumit singh is currently offline sumit singhFriend
Messages: 139
Registered: October 2012
Location: Bangalore
Senior Member

Hmm, Ok Brian.

Thanks for replying .Smile
Previous Topic:Multiple workspaces cause RCP app to load IDE workspace
Next Topic:Read resource from "Plug-in from existing JAR archives"
Goto Forum:
  


Current Time: Tue Dec 23 00:51:42 GMT 2014

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

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