Bug 155479 - [Jobs] Job Progress Dialog should allow disabling of cancel button
Summary: [Jobs] Job Progress Dialog should allow disabling of cancel button
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P5 enhancement with 30 votes (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2006-08-28 22:15 EDT by David Taieb CLA
Modified: 2016-05-03 02:26 EDT (History)
27 users (show)

See Also:


Attachments
Partial fix (5.91 KB, patch)
2009-01-30 16:18 EST, Eugene Ostroukhov CLA
no flags Details | Diff
Screenshot of the progress dialog with cancelable and uncancelable jobs. (17.41 KB, image/png)
2009-01-30 16:22 EST, Eugene Ostroukhov CLA
no flags Details
Alternative API (4.72 KB, patch)
2009-04-22 16:13 EDT, Eugene Ostroukhov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Taieb CLA 2006-08-28 22:15:43 EDT
We have a long running User Job that at some point during its execution cannot be cancelled. We need an API to be able to programmatically disable the Cancel button in the  Progress dialog or in the progress view
Comment 1 iristest2004 CLA 2007-01-16 18:08:43 EST
We also need the ability to disable user cancellation for certain Jobs, particularly in the Progress View. There are many background jobs that we run (and BTW we are using the Rich Client Platform) which are started by the system which ought not to be able to be canceled by the user. Unfortunately, even marking them system jobs doesn't put them out of reach of the user since the Progress View allows the user to show system jobs. But even some non-system jobs we would like to make uncancellable by the user.

So, specifically, we would like the ability to disable the Cancel button in the Progress View for any Job, system or non-system.
Comment 2 Remy Suen CLA 2008-11-07 08:14:37 EST
We would love this functionality in our RCP application also.
Comment 3 Eugene Ostroukhov CLA 2009-01-30 16:18:58 EST
Created attachment 124330 [details]
Partial fix

This patch adds set/is Cancelable methods to the Job class. Progress view  will honor this property by not showing the red square button. Progress dialog will disable the cancel button.

This property is not meant to be dynamic - i.e. UI will not reflect property change while the job is running.
Comment 4 Eugene Ostroukhov CLA 2009-01-30 16:22:17 EST
Created attachment 124332 [details]
Screenshot of the progress dialog with cancelable and uncancelable jobs.
Comment 5 ngdtrieu CLA 2009-04-21 19:17:50 EDT
It's so good. Where can i get path of it ?
Comment 6 Remy Suen CLA 2009-04-22 08:55:48 EDT
(In reply to comment #3)
> This patch adds set/is Cancelable methods to the Job class. Progress view  will
> honor this property by not showing the red square button. Progress dialog will
> disable the cancel button.

Eugene, if your patch requires modifying code in the Jobs API then I suggest you file a bug against Platform/Runtime with it detailing your needs and keep this bug here for the UI aspects of it.
Comment 7 Eugene Ostroukhov CLA 2009-04-22 09:06:57 EDT
That would get so more complex from organizational POV - I'm most certain it won't make it into 3.5 (i.e. our product would definitely use it if it was in 3.5).

I considered using a Job get/set property for this. The problem is that it will get much more complex for API users to discover how to do this. Q: Is there a chance this will be in 3.5 if I switch to using get/set property? If not, then I will open another bug.
Comment 8 Remy Suen CLA 2009-04-22 09:36:06 EDT
Sending back to inbox for triage.
Comment 9 Eugene Ostroukhov CLA 2009-04-22 10:59:04 EDT
Just noticed that IProgressConstants is in org.eclipse.ui.progress. Would it be in scope of this PR to patch it?
Comment 10 Eugene Ostroukhov CLA 2009-04-22 16:13:15 EDT
Created attachment 132831 [details]
Alternative API

This is another approach we could use:
setProperty(IProgressConstants.CANCELABLE_PROPERTY, Boolean.FALSE);

This way all changes are limited to org.eclipse.ui.workbench. I created the patch against head as of time I wrote this comment.

This approach is still limited - i.e. the property should be set before the Job is scheduled. UI will not reflect changes afterwards.
Comment 11 Prakash Rangaraj CLA 2009-07-23 07:28:31 EDT
Is it ok in a broader perspective to make a Job non-cancellable? If so then probably we can add the isCancellable API to the job class itself. Moving to Platform Runtime for comments.
Comment 12 Min Idzelis CLA 2009-12-11 11:05:24 EST
(In reply to comment #11)
> Is it ok in a broader perspective to make a Job non-cancellable? If so then
> probably we can add the isCancellable API to the job class itself. Moving to
> Platform Runtime for comments.

I'd like to weigh in and say that I think isCancellable() would be a good improvement to the Job class. 

This is because there is a small bit of inconsistency here. Cancelation is a *request* on a IProgressMonitor. It does not NEED to be honoured by the Job's run method. However, it IS *always* honoured by the JobManager. 

Let me explain. If a Job is waiting (scheduled to run after a delay, or blocked) and then cancel() is issued on the Job that Job will not run. The Job hasn't even started running yet and it was killed off. (Note: a way to workaround this is to install a JobChangeListener and reschedule a Job if it is canceled) 

I like the idea of having an isCancellable() API on Job because then if cancel is issued on a sleeping Job, it will still get a chance to run eliminating the need for a listener and the noise that comes with rescheduling.
Comment 13 chaitanya tangudu CLA 2010-02-16 15:31:01 EST
I ran into similar requirement for having non-cancelable jobs (user shouldn't be able to cancel the job at any point of time, after he triggered). So there is no way to achieve with current API right? So when do we expect the patch suggested in  the thread in Job class. Please let me know for any suggestions/opinions. Thanks in advance.
Comment 14 marwan simaan CLA 2010-10-15 04:49:03 EDT
What is the status of this enhancement?
Comment 15 Tom Crockett CLA 2011-06-09 20:30:21 EDT
Is this in limbo? We really want this!
Comment 16 Aljoscha Hark CLA 2011-09-22 22:52:08 EDT
it would also be nice when a job could be set un/cancelable during its run.

for example on a long running operation in which a emf resource is loaded you could setCancelable(false) just before the Resource.load(Map) and set it to true just afterwards.
Comment 17 Heiko Böttger CLA 2012-07-24 11:43:56 EDT
I currently have the same problem here, where I just want to inform the user about a progress that takes some time. This job cannot be canceled, because the application would otherwise not running correctly. When running in background this just informs the user that some function might not work as long the initialization is not finished.
Comment 18 Shwetha Venkatesh CLA 2016-03-22 14:49:47 EDT
Any update, if this issue is fixed or not.

Is it possible to disable the "Cancel" button in the progress dialog displayed when a job is running? I still want to maintain the functionality to show to user about progress in the job to the background. Letting the job run or canceling it has no effect on the GUI, as it starts a task on a remote server, which does not support cancellation/stopping the task, once started.