-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SlicedProgressMonitor: fix canceled() #428
Conversation
as soon as is started using sliced() cancel test fails because cancel is not forwarded: org.eclipse.ltk.core.refactoring.tests.participants.CancelingParticipantTests
|
@@ -86,6 +86,7 @@ public boolean isCanceled() { | |||
|
|||
@Override | |||
public void setCanceled(boolean value) { | |||
monitor.setCanceled(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want this you need to synchronize
on the monitor instance, beside that one usually don't want to cancel a slice, what is the use-case for that? According to the javadoc a monitor passed to a method should actually never call cancel so I'm not sure what these cancel tests "test"?
Just to give some context, You probably want to use |
I don't want to use SubMonitor.split(...) because it requires to construct a Submonitor instance before which does not refactor as easy. If split() works on multiple threads it should also work on single threads. But ok: i see org.eclipse.core.runtime.IProgressMonitor.slice(int) javadoc indeed specified cancel() is not passed. How useless - at least for my usecase :-( |
I must confess I don't understand you call
Please read the docs,
As explained, the cancel is to allow to cancel the one computation forked in a different thread, if you want to cancel all you need to call cancel on the monitor where you have started the split.
For your usecase there is already |
if you do it on new code - ok. but we have hundrets of calls where i found no pattern convert all at once :-( |
I usually do the following:
maybe this can be automated with rewrite-maven-plugin one day... |
as soon as is started using sliced() cancel test fails because cancel is not forwarded:
org.eclipse.ltk.core.refactoring.tests.participants.CancelingParticipantTests