Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Starting commands manually(How do I start a command from a handler or when the application starts?)
Starting commands manually [message #820020] Tue, 13 March 2012 16:20 Go to next message
Tomasz Stelmach is currently offline Tomasz Stelmach
Messages: 1
Registered: March 2012
Junior Member
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 16:29 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
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
Previous Topic:Migration existing app from 3.7 RCP to e4 RCP
Next Topic:Set Shell Properties From a Composite Node in XWT
Goto Forum:
  


Current Time: Fri Oct 24 18:21:54 GMT 2014

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

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