1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Switch from SubProgressMonitor to SubMonitor to improve progress

reporting.

Signed-off-by: Stefan Xenos <sxenos@google.com>
Change-Id: Ibd635b59d17e88f93439c7041994b6006d74434e
This commit is contained in:
Stefan Xenos 2015-05-06 21:24:35 -07:00 committed by Sergey Prigogin
parent 07117f922a
commit 4dc26f9a20

View file

@ -29,7 +29,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
@ -106,7 +106,9 @@ public class TargetBuild {
Job targetJob = new Job(MakeUIPlugin.getResourceString("TargetBuild.backgroundTask.name")) { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(MakeUIPlugin.getResourceString("TargetBuild.monitor.beginTask"), targets.length); //$NON-NLS-1$
SubMonitor subMonitor = SubMonitor.convert(monitor,
MakeUIPlugin.getResourceString("TargetBuild.monitor.beginTask"), //$NON-NLS-1$
targets.length);
try {
for (int i = 0; i < targets.length; i++) {
final IMakeTarget target = targets[i];
@ -114,10 +116,10 @@ public class TargetBuild {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
target.build(new SubProgressMonitor(monitor, 1));
target.build(monitor);
}
};
MakeUIPlugin.getWorkspace().run(runnable, null, IResource.NONE, monitor);
MakeUIPlugin.getWorkspace().run(runnable, null, IResource.NONE, subMonitor.newChild(1));
}
} catch (CoreException e) {
return e.getStatus();