Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Showing a Dialog Whilst Running a Job
Showing a Dialog Whilst Running a Job [message #452851] Tue, 18 July 2006 06:19 Go to next message
Eclipse UserFriend
Hi,

I have a requirement to conditionally show a Dialog part way through
running a job (org.eclipse.core.runtime.jobs.Job), so the job may be
running in the background.

I have worked out how to show a popup when the job has finished, and
there's also a facility to show a popup as the job is about to start (and
at several other points in the lifecycle), but how can I get a dialog or
popup part way through ?

Anyone got any ideas?

Thanks

Dave.
Re: Showing a Dialog Whilst Running a Job [message #452928 is a reply to message #452851] Tue, 18 July 2006 19:20 Go to previous messageGo to next message
Eclipse UserFriend
Is the job blocking? If not, and you have time in the run method, you
can show it, or fire off an event to a listener who could show it.
Otherwise it'd be a bit odd to have a property on the job of a method to
call "some time" during the job.

On Tue, 2006-07-18 at 10:19 +0000, Dave wrote:
> Hi,
>
> I have a requirement to conditionally show a Dialog part way through
> running a job (org.eclipse.core.runtime.jobs.Job), so the job may be
> running in the background.
>
> I have worked out how to show a popup when the job has finished, and
> there's also a facility to show a popup as the job is about to start (and
> at several other points in the lifecycle), but how can I get a dialog or
> popup part way through ?
>
> Anyone got any ideas?
>
> Thanks
>
> Dave.
>
Re: Showing a Dialog Whilst Running a Job [message #452941 is a reply to message #452928] Wed, 19 July 2006 06:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi Nick,

thanks for your reply.

The requirement is to warn the user before the Job does something, and
allow the user to quit.

The problem is that the dialog that launched the Job has now closed and
been disposed, and to show a dialog asking the question I need a shell
handle.

What should one normally do in this situation?

Regards

Dave.
Re: Showing a Dialog Whilst Running a Job [message #452944 is a reply to message #452941] Wed, 19 July 2006 06:53 Go to previous messageGo to next message
Eclipse UserFriend
Use PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShel l()
this will give you the shell of the active workbench window.
I assume the dialog you are showing is modal so there shouldn't be an
issue with this.

Regards
Stefan

Dave wrote:
> Hi Nick,
>
> thanks for your reply.
>
> The requirement is to warn the user before the Job does something, and
> allow the user to quit.
>
> The problem is that the dialog that launched the Job has now closed and
> been disposed, and to show a dialog asking the question I need a shell
> handle.
>
> What should one normally do in this situation?
>
> Regards
>
> Dave.
>
Re: Showing a Dialog Whilst Running a Job [message #452945 is a reply to message #452941] Wed, 19 July 2006 06:53 Go to previous messageGo to next message
Eclipse UserFriend
> The problem is that the dialog that launched the Job has now closed and
> been disposed, and to show a dialog asking the question I need a shell
> handle.
>
> What should one normally do in this situation?

Don't use the shell of the launching dialog as parent of your question
dialog. Instead you should try to use the IWorkbenchWindow.getShell()
as parent. And don't forget to check for disposal of the shell and
accessibility of the workbenchwindow before attempting to open the 2nd
dialog!

Greetings from Bremen,

Daniel Krügler
Re: Showing a Dialog Whilst Running a Job [message #452985 is a reply to message #452944] Wed, 19 July 2006 09:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi Stefan,

in my example, what you suggest fails because getActiveWorkbenchWindow()
returns null.

I'm beginning to think that the only way round this is to use a view
instead of Dialog (ie something that stays active in the workbench), but
that's not bulletproof either, as it's unlikely, but not impossible that
the user closes the view, unless I can find a way to prevent that.

What's the normal thing to do when you just want to get a shell in order
to show a dialog or something?


Stefan Langer wrote:

> Use PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShel l()
> this will give you the shell of the active workbench window.
> I assume the dialog you are showing is modal so there shouldn't be an
> issue with this.

> Regards
> Stefan

> Dave wrote:
>> Hi Nick,
>>
>> thanks for your reply.
>>
>> The requirement is to warn the user before the Job does something, and
>> allow the user to quit.
>>
>> The problem is that the dialog that launched the Job has now closed and
>> been disposed, and to show a dialog asking the question I need a shell
>> handle.
>>
>> What should one normally do in this situation?
>>
>> Regards
>>
>> Dave.
>>
Re: Showing a Dialog Whilst Running a Job [message #453007 is a reply to message #452985] Thu, 20 July 2006 03:17 Go to previous message
Eclipse UserFriend
Create a dialog without a shell. As far as I know when you pass in null
the dialog simply creates its own shell. This has the drawback that when
the dialog is modal it might dissapear behind other windows in certain
cases and the user won'T see it anymore but the UI is still unresponsive.

Another solution is to simply create your own shell and pass that in.

Regards
Stefan

Dave wrote:
> Hi Stefan,
>
> in my example, what you suggest fails because getActiveWorkbenchWindow()
> returns null.
>
> I'm beginning to think that the only way round this is to use a view
> instead of Dialog (ie something that stays active in the workbench), but
> that's not bulletproof either, as it's unlikely, but not impossible that
> the user closes the view, unless I can find a way to prevent that.
>
> What's the normal thing to do when you just want to get a shell in order
> to show a dialog or something?
>
>
> Stefan Langer wrote:
>
>> Use PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShel l()
>> this will give you the shell of the active workbench window.
>> I assume the dialog you are showing is modal so there shouldn't be an
>> issue with this.
>
>> Regards
>> Stefan
>
>> Dave wrote:
>>> Hi Nick,
>>>
>>> thanks for your reply.
>>>
>>> The requirement is to warn the user before the Job does something,
>>> and allow the user to quit.
>>>
>>> The problem is that the dialog that launched the Job has now closed
>>> and been disposed, and to show a dialog asking the question I need a
>>> shell handle.
>>>
>>> What should one normally do in this situation?
>>>
>>> Regards
>>>
>>> Dave.
>>>
>
Previous Topic:Open View with an Action
Next Topic:Understanding Eclipse-ExtensibleAPI and Eclipse-PatchFragment
Goto Forum:
  


Current Time: Sun Jul 06 01:47:35 EDT 2025

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

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

Back to the top