Skip to content
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

Use SubMonintor in CheckConditionsContext #2574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;

Expand Down Expand Up @@ -102,8 +100,7 @@ public void add(IConditionChecker checker) throws CoreException {
* @throws CoreException if an error occurs during condition checking
*/
public RefactoringStatus check(IProgressMonitor pm) throws CoreException {
if (pm == null)
pm= new NullProgressMonitor();

RefactoringStatus result= new RefactoringStatus();
mergeResourceOperationAndValidateEdit();
List<IConditionChecker> values= new ArrayList<>(fCheckers.values());
Expand All @@ -117,13 +114,11 @@ public RefactoringStatus check(IProgressMonitor pm) throws CoreException {
return 1;
return 0;
});

SubMonitor sm= SubMonitor.convert(pm, "", values.size()); //$NON-NLS-1$
for (IConditionChecker checker : values) {
result.merge(checker.check(sm.split(1)));
if (pm.isCanceled())
throw new OperationCanceledException();
}
pm.done();
return result;
}

Expand Down
Loading