Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » I dont know how to use the IProgressMonitor stop button :(
I dont know how to use the IProgressMonitor stop button :( [message #497026] Thu, 12 November 2009 10:06 Go to next message
Juan is currently offline JuanFriend
Messages: 29
Registered: July 2009
Junior Member
Hi everybody!

I have a IProgressMonitor that I used when I launch a process since my
RCP: monitor.beginTask("Launching planner...",
IProgressMonitor.UNKNOWN);

I need to give users the posibility to stop the process using the stop
button of this progress monitor (it appears by default) but that button
do nothing when pressed and I don't know how to listen when user press
that button.

I've thought to implement an async thread that checks by polling if
monitor.isCanceled() is true, but I think that is not the best way.Does
anybody has an idea about this?

Thanks a lot and the best regards.
Re: I dont know how to use the IProgressMonitor stop button :( [message #497050 is a reply to message #497026] Thu, 12 November 2009 11:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Juan,

Generally the code itself that's using the monitor to trace progress
should be checking the flag and terminating quickly...


Juan Miguel wrote:
> Hi everybody!
>
> I have a IProgressMonitor that I used when I launch a process since my
> RCP: monitor.beginTask("Launching planner...",
> IProgressMonitor.UNKNOWN);
>
> I need to give users the posibility to stop the process using the stop
> button of this progress monitor (it appears by default) but that
> button do nothing when pressed and I don't know how to listen when
> user press that button.
>
> I've thought to implement an async thread that checks by polling if
> monitor.isCanceled() is true, but I think that is not the best
> way.Does anybody has an idea about this?
>
> Thanks a lot and the best regards.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: I dont know how to use the IProgressMonitor stop button :( [message #497096 is a reply to message #497050] Thu, 12 November 2009 13:32 Go to previous messageGo to next message
Juan is currently offline JuanFriend
Messages: 29
Registered: July 2009
Junior Member
> Generally the code itself that's using the monitor to trace progress
> should be checking the flag and terminating quickly...
Yes, you're right but I was looking another sort of help, because it's
that checking of the flag what I dont know how to implement.

> Please don't cross post the same question to multiple newsgroups;
this isn't an SWT question.

Yes you're right. But think that the problem is relates to a
org.eclipse.jface.operation.AccumulatingProgressMonitor and I thought
some people expert in SWT perhaps would know something about this.Sorry.


Thanks!

Ed Merks escribió:
> Juan,
>
> Generally the code itself that's using the monitor to trace progress
> should be checking the flag and terminating quickly...
>
>
> Juan Miguel wrote:
>> Hi everybody!
>>
>> I have a IProgressMonitor that I used when I launch a process since my
>> RCP: monitor.beginTask("Launching planner...",
>> IProgressMonitor.UNKNOWN);
>>
>> I need to give users the posibility to stop the process using the stop
>> button of this progress monitor (it appears by default) but that
>> button do nothing when pressed and I don't know how to listen when
>> user press that button.
>>
>> I've thought to implement an async thread that checks by polling if
>> monitor.isCanceled() is true, but I think that is not the best
>> way.Does anybody has an idea about this?
>>
>> Thanks a lot and the best regards.
Re: I dont know how to use the IProgressMonitor stop button :( [message #498101 is a reply to message #497026] Sat, 14 November 2009 13:30 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Juan,

The pattern is like this (ignore the bad !style).

mon.

doWork(IProgressMonitor mon){

boolean workComplete = false;
while(!mon.isCancelled() && !workComplete){
workComplete = a_little_work(); }

if(!workComplete && mon.isCancelled){
dialog("You pressed the cancel button before work was complete")
}
}

Now, the good behaviour is to check the cancel button frequently.

Best regards,

Wim

> Hi everybody!
>
> I have a IProgressMonitor that I used when I launch a process since my
> RCP: monitor.beginTask("Launching planner...",
> IProgressMonitor.UNKNOWN);
>
> I need to give users the posibility to stop the process using the stop
> button of this progress monitor (it appears by default) but that button
> do nothing when pressed and I don't know how to listen when user press
> that button.
>
> I've thought to implement an async thread that checks by polling if
> monitor.isCanceled() is true, but I think that is not the best way.Does
> anybody has an idea about this?
>
> Thanks a lot and the best regards.
Previous Topic:Registring a new Action outside the ApplicationActionBarAdvisor
Next Topic:How to set the editor title?
Goto Forum:
  


Current Time: Wed Apr 24 19:52:48 GMT 2024

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

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

Back to the top