Starting commands manually [message #820020] |
Tue, 13 March 2012 12:20  |
Eclipse User |
|
|
|
Hi,
Just started implementing my first E4 project and everything was working fine (building GUI, etc.) until I reached the point of implementing the use cases. So the application is a client which connects to the server. Therefore I have created two commands with handlers:
- login - which shows the window to enter login/password and connects to the server
- logout - which disconnects from the server
I have two issues with. They come from the requirement which says that application should always be connected to the server. So I have to do two things:
1) I have to invoke the "login" command during application startup but frankly speaking I don't really know where the proper place for this is in the code...
2) I have to invoke the "login" command right after the "logout" command is finished, so basically I need to call another command at the end of the handler's execute() method.
I have no idea how to get access to the commands to invoke them manually. I've been googling but all the available tutorials focus on creating simple applications only (without this kind of features). Any help will be appreciated.
|
|
|
Re: Starting commands manually [message #820027 is a reply to message #820020] |
Tue, 13 March 2012 12:29  |
Eclipse User |
|
|
|
Am 13.03.12 17:20, schrieb Tomasz Stelmach:
> Hi,
> Just started implementing my first E4 project and everything was working
> fine (building GUI, etc.) until I reached the point of implementing the
> use cases. So the application is a client which connects to the server.
> Therefore I have created two commands with handlers:
> - login - which shows the window to enter login/password and connects to
> the server
> - logout - which disconnects from the server
>
> I have two issues with. They come from the requirement which says that
> application should always be connected to the server. So I have to do
> two things:
>
> 1) I have to invoke the "login" command during application startup but
> frankly speaking I don't really know where the proper place for this is
> in the code...
I'm not sure if you can execute commands while the framework is
launching. You can install a so called lifecycle-handler through your
product extension point, annotate one of the methods PostContextCreate.
See this blog post: http://marcteufel.wordpress.com/2011/05/05/231/ in
>M5 you should use the bundleclass-uri instead.
>
> 2) I have to invoke the "login" command right after the "logout" command
> is finished, so basically I need to call another command at the end of
> the handler's execute() method.
> I have no idea how to get access to the commands to invoke them
> manually. I've been googling but all the available tutorials focus on
> creating simple applications only (without this kind of features). Any
> help will be appreciated.
ECommandService and EHandlerService can be used simply let the framework
inject them.
Tom
|
|
|
Powered by
FUDForum. Page generated in 0.24014 seconds