Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Blocking command execution (wainting for results)
Blocking command execution (wainting for results) [message #481728] Mon, 24 August 2009 06:37 Go to next message
Eclipse UserFriend
Originally posted by: eclipsercp.nurfuerspam.de

Hi,

I am wondering how it is possible to execute a command in a way that the
application waits for the command to complete.

At the moment I execute the command like this:

IHandlerService service = (IHandlerService) Workbench.getInstance()
getService(IHandlerService.class);
result = service.executeCommand(commandName, event);
// do something with the result

This makes the command to be executed in another thread some time later.
What I want is to execute the command immediately and wait for it to
complete. Then I want to continue working with the commands result.

Is this possible?
Thanks,
Krid
Re: Blocking command execution (wainting for results) [message #481733 is a reply to message #481728] Mon, 24 August 2009 07:06 Go to previous messageGo to next message
Charlie Kelly is currently offline Charlie KellyFriend
Messages: 276
Registered: July 2009
Senior Member
Hello Krid,

See the "Jobs" API, in particular workspace job.

Jobs run asychronously from the UI thread.
You will need a "JobAdapter" to process your results
(possibly using an AsynchExec to update UI elements).

Charlie


Krid wrote:
> Hi,
>
> I am wondering how it is possible to execute a command in a way that the
> application waits for the command to complete.
>
> At the moment I execute the command like this:
>
> IHandlerService service = (IHandlerService) Workbench.getInstance()
> getService(IHandlerService.class);
> result = service.executeCommand(commandName, event);
> // do something with the result
>
> This makes the command to be executed in another thread some time later.
> What I want is to execute the command immediately and wait for it to
> complete. Then I want to continue working with the commands result.
>
> Is this possible?
> Thanks,
> Krid
>
Re: Blocking command execution (wainting for results) [message #481756 is a reply to message #481733] Mon, 24 August 2009 08:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipsercp.nurfuerspam.de

Hi and thanks for your reply,

my problem is not to execute a job asynchronously but to execute a Eclipse
command synchronously!

Krid

Charlie Kelly wrote:

> Hello Krid,

> See the "Jobs" API, in particular workspace job.

> Jobs run asychronously from the UI thread.
> You will need a "JobAdapter" to process your results
> (possibly using an AsynchExec to update UI elements).

> Charlie
Re: Blocking command execution (wainting for results) [message #481769 is a reply to message #481756] Mon, 24 August 2009 09:13 Go to previous message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 117
Registered: July 2009
Location: Seoul
Senior Member

I think you've some miss on tracing your code flow.

Why do you think command will be executed on separated thread?

Command is not executed on separated thread except you invoke that in
separated thread. At almost, They are executed on main UI thread,
because handlers have high chance to fire event that needs to updating UI.

If you just give complicate and slow codes in handler then You can see
UI which is not respond while.

So, just describe your command execution and handling result in same
code block in sequence. that's no problem. Whatever job or not.

Krid wrote:
> Hi and thanks for your reply,
>
> my problem is not to execute a job asynchronously but to execute a
> Eclipse command synchronously!
>
> Krid
>
> Charlie Kelly wrote:
>
>> Hello Krid,
>
>> See the "Jobs" API, in particular workspace job.
>
>> Jobs run asychronously from the UI thread.
>> You will need a "JobAdapter" to process your results
>> (possibly using an AsynchExec to update UI elements).
>
>> Charlie
>
>
>
Previous Topic:PropertTester
Next Topic:Coolbar layout
Goto Forum:
  


Current Time: Fri Apr 26 18:09:15 GMT 2024

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

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

Back to the top