diff options
author | Darin Wright | 2009-04-17 18:14:45 +0000 |
---|---|---|
committer | Darin Wright | 2009-04-17 18:14:45 +0000 |
commit | 72b5e0d6939e96b60c14c4e2c87e5f9e8abee0ad (patch) | |
tree | f25fc257a3440f907abdd63d3d4bf4d6f04c9883 | |
parent | a31d6c9d0b413dee61c233112ea0b5fec99ac6a9 (diff) | |
download | eclipse.platform.debug-72b5e0d6939e96b60c14c4e2c87e5f9e8abee0ad.tar.gz eclipse.platform.debug-72b5e0d6939e96b60c14c4e2c87e5f9e8abee0ad.tar.xz eclipse.platform.debug-72b5e0d6939e96b60c14c4e2c87e5f9e8abee0ad.zip |
Bug 268978 - Build before launch should use one top level workspace runnable
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java index e7007d988..5731a9c78 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -408,21 +409,26 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio * @param monitor progress monitor * @throws CoreException if an exception occurs while building */ - protected void buildProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException { - if (monitor != null) { - monitor.beginTask("", projects.length); //$NON-NLS-1$ - } - try { - for (int i = 0; i < projects.length; i++ ) { - if (monitor != null && monitor.isCanceled()) { - throw new OperationCanceledException(); + protected void buildProjects(final IProject[] projects, IProgressMonitor monitor) throws CoreException { + IWorkspaceRunnable build = new IWorkspaceRunnable(){ + public void run(IProgressMonitor pm) throws CoreException { + try { + if (pm != null) { + pm.beginTask("", projects.length); //$NON-NLS-1$ + } + for (int i = 0; i < projects.length; i++ ) { + if (pm != null && pm.isCanceled()) { + throw new OperationCanceledException(); + } + projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(pm, 1)); + } + } finally { + if (pm != null) { + pm.done(); + } } - projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(monitor, 1)); } - } finally { - if (monitor != null) { - monitor.done(); - } - } + }; + ResourcesPlugin.getWorkspace().run(build, monitor); } } |