Commands, Actions, Handlers, and buttons [message #494519] |
Fri, 30 October 2009 20:42  |
Eclipse User |
|
|
|
I have moved my actions into commands with handlers in anticipation that the
Action approach will eventually become deprecated. All is well when I am
attaching such commands to menus.
Unfortunately, I also need to have buttons and various other widgets carry
out certain actions - I would like this to be done with the same
AbstractHandlers that I have created for the menu commands.
How do I invoke the command handlers outside of menu situations?
Specifically, as the result of a button selection event?
Thanks.
- Mike
|
|
|
Re: Commands, Actions, Handlers, and buttons [message #494587 is a reply to message #494519] |
Sat, 31 October 2009 13:46  |
Eclipse User |
|
|
|
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--B_3339834373_52278968
Content-type: text/plain;
charset="US-ASCII"
Content-transfer-encoding: 7bit
Sorry - stumbled into the answer. For others who may be confused, here is
code:
selectPatientButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
IHandlerService handlerService = (IHandlerService)
getSite().getService(IHandlerService.class);
try {
handlerService.executeCommand("edu.utah.cdmcc.commands.SelectPatient ",
null);
} catch (ExecutionException e1) {
e1.printStackTrace();
} catch (NotDefinedException e1) {
e1.printStackTrace();
} catch (NotEnabledException e1) {
e1.printStackTrace();
} catch (NotHandledException e1) {
e1.printStackTrace();
}
}
});
On 10/30/09 6:42 PM, in article C710E40C.27CCC%mdean77@comcast.net, "J
Michael Dean" <mdean77@comcast.net> wrote:
> I have moved my actions into commands with handlers in anticipation that the
> Action approach will eventually become deprecated. All is well when I am
> attaching such commands to menus.
>
> Unfortunately, I also need to have buttons and various other widgets carry
> out certain actions - I would like this to be done with the same
> AbstractHandlers that I have created for the menu commands.
>
> How do I invoke the command handlers outside of menu situations?
> Specifically, as the result of a button selection event?
>
> Thanks.
>
> - Mike
>
--B_3339834373_52278968
Content-type: text/html;
charset="US-ASCII"
Content-transfer-encoding: quoted-printable
<HTML>
<HEAD>
<TITLE>Re: Commands, Actions, Handlers, and buttons</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:11pt=
'>Sorry - stumbled into the answer. For others who may be confused, he=
re is code:<BR>
<BR>
selectPatientButton.addSele=
ctionListener(new SelectionAdapter() {<BR>
pub=
lic void widgetSelected(final SelectionEvent e) {<BR>
&nb=
sp; IHandlerService handlerService =3D (IHandlerService) getS=
ite().getService(IHandlerService.class);<BR>
&nb=
sp; try {<BR>
&nb=
sp; &nb sp; handlerService.executeCommand(&=
quot;edu.utah.cdmcc.commands.SelectPatient", null);<BR>
&nb=
sp; } catch (ExecutionException e1) {<BR>
&nb=
sp; &nb sp; e1.printStackTrace(); <BR>
&nb=
sp; } catch (NotDefinedException e1) {<BR>
&nb=
sp; &nb sp; e1.printStackTrace(); <BR>
&nb=
sp; } catch (NotEnabledException e1) {<BR>
&nb=
sp; &nb sp; e1.printStackTrace(); <BR>
&nb=
sp; } catch (NotHandledException e1) {<BR>
&nb=
sp; &nb sp; e1.printStackTrace(); <BR>
&nb=
sp; }<BR>
} <B=
R>
}); <BR>
<BR>
<BR>
<BR>
On 10/30/09 6:42 PM, in article <a href=3D"C710E40C.27CCC%mdean77@comcast.net=
">C710E40C.27CCC%mdean77@comcast.net</a>, "J Michael Dean" <<a =
href=3D"mdean77@comcast.net">mdean77@comcast.net</a>> wrote:<BR>
<BR>
<FONT COLOR=3D"#0000FF">> I have moved my actions into commands with handl=
ers in anticipation that the<BR>
> Action approach will eventually become deprecated. All is well w=
hen I am<BR>
> attaching such commands to menus.<BR>
> <BR>
> Unfortunately, I also need to have buttons and various other widgets c=
arry<BR>
> out certain actions - I would like this to be done with the same<BR>
> AbstractHandlers that I have created for the menu commands.<BR>
> <BR>
> How do I invoke the command handlers outside of menu situations?<BR>
> Specifically, as the result of a button selection event?<BR>
> <BR>
> Thanks.<BR>
> <BR>
> - Mike<BR>
> <BR>
</FONT></SPAN></FONT>
</BODY>
</HTML>
--B_3339834373_52278968--
|
|
|
Powered by
FUDForum. Page generated in 0.05075 seconds