Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] IProgressMonitor - cancelling operations

> 
> Hey everybody,
> 
> I'd like to stimulate some discussion as to the best approach to deal 
> with a user canceling a long-running operation in CDT 2.0.  In 
> particular I was recently stung by an uncaught OperationCanceledException:
> 
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=51250
> 
> As a policy for CDT 2.0 and beyond, I propose that UI code should throw 
> InterruptedException rather than OperationCanceledException in response 
> to a user canceling a progress dialog.
> 
> To quote from _Contributing to Eclipse_ (Gamma & Beck, p.188):
> 

Ho !! some heavy artillery.
Not much room to argue, if you are quoting the heavy weigths 8-)

So ...

+ 1


> .   To find out whether a user has requested a cancellation, the
> . operation should call [IProgressMonitor] isCanceled() frequently.  If
> . the user requests a cancellation, the operation should be terminated
> . by throwing an exception.  The exception can be either an
> . InterruptedException or an OperationCanceledException.  We prefer
> . InterruptedException because wherever possible you want to reuse
> . existing types rather than introduce your own.
> . (OperationCanceledException is still supported for backwards
> . compatibility).  This is a snippet you will find in many Eclipse
> . operations:
> 


-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!



Back to the top