Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to make a modal Job ?
How to make a modal Job ? [message #542634] Fri, 25 June 2010 13:52 Go to next message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris
Member
Hello guyz,

I would like to create a modal Job, that is to say :
* The job need to run in a worker thread as any other job
* I only need the "progress" job dialog to be modal, thus not allowing the user to interact with the workbench until the job has finished

Simple need, but looks hard to implement.
I was considering implementing a UIJob wrapper which would fire a regular job, listens for completion, and prevents user actions while dispatching UI events...

But I think if I dispatch UI events the user will be able to interact with the workbench (so this will be helpless) and if I do not dispatch the UI will look like "frozen", and I definitly don't want this either.

Any idea ?

Thanks,
Christophe
http://www.nextep-softwares.com
Re: How to make a modal Job ? [message #542740 is a reply to message #542634] Fri, 25 June 2010 18:35 Go to previous message
tranquility Missing name is currently offline tranquility Missing nameFriend
Messages: 2
Registered: March 2010
Junior Member
Hello

Maybe this approach will help? (It's just a quick idea)



Greetings


> private class ButtonListener extends SelectionAdapter {
> @Override
> public void widgetSelected(SelectionEvent e) {
> super.widgetSelected(e);
>
> // Job starten
> try {
> PlatformUI.getWorkbench().getProgressService()
> .busyCursorWhile(new IRunnableWithProgress() {
> public void run(IProgressMonitor monitor) {
>
> try {
> monitor.beginTask("long running task ", 10);
> for (int i = 0; i < 10; i++) {
> Thread.currentThread().sleep(2000);
> monitor.worked(i);
> }
> } catch (InterruptedException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> }
> });
> } catch (InvocationTargetException e1) {
> e1.printStackTrace();
> } catch (InterruptedException e1) {
> e1.printStackTrace();
> }
> }
> }
>





Am 25.06.2010 15:52, schrieb Christophe Fondacci:
> Hello guyz,
>
> I would like to create a modal Job, that is to say :
> * The job need to run in a worker thread as any other job
> * I only need the "progress" job dialog to be modal, thus not allowing
> the user to interact with the workbench until the job has finished
>
> Simple need, but looks hard to implement.
> I was considering implementing a UIJob wrapper which would fire a
> regular job, listens for completion, and prevents user actions while
> dispatching UI events...
> But I think if I dispatch UI events the user will be able to interact
> with the workbench (so this will be helpless) and if I do not dispatch
> the UI will look like "frozen", and I definitly don't want this either.
>
> Any idea ?
>
> Thanks,
> Christophe
> http://www.nextep-softwares.com
>
Previous Topic:Center wizard relative to workbench
Next Topic:Disabling save for dirty Editor Part
Goto Forum:
  


Current Time: Sun Dec 05 21:50:44 GMT 2021

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

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

Back to the top