mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Get LaunchBar builds off of the UI thread.
This commit is contained in:
parent
ae1b12338a
commit
ddd0df6db8
1 changed files with 47 additions and 40 deletions
|
@ -15,8 +15,6 @@ import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchDescriptor;
|
|
||||||
import org.eclipse.cdt.launchbar.core.ILaunchTarget;
|
|
||||||
import org.eclipse.cdt.launchbar.core.internal.LaunchBarManager;
|
import org.eclipse.cdt.launchbar.core.internal.LaunchBarManager;
|
||||||
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
import org.eclipse.cdt.launchbar.ui.internal.Activator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
@ -32,6 +30,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchDelegate;
|
import org.eclipse.debug.core.ILaunchDelegate;
|
||||||
import org.eclipse.debug.core.ILaunchMode;
|
import org.eclipse.debug.core.ILaunchMode;
|
||||||
|
@ -61,16 +60,18 @@ public class BuildActiveCommandHandler extends AbstractHandler {
|
||||||
|
|
||||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
LaunchBarManager launchBarManager = Activator.getDefault().getLaunchBarUIManager().getManager();
|
final LaunchBarManager launchBarManager = Activator.getDefault().getLaunchBarUIManager().getManager();
|
||||||
ILaunchDescriptor desc = launchBarManager.getActiveLaunchDescriptor();
|
final ILaunchConfiguration config = launchBarManager.getActiveLaunchConfiguration();
|
||||||
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
|
|
||||||
ILaunchConfiguration config = launchBarManager.getLaunchConfiguration(desc, target);
|
|
||||||
|
|
||||||
Collection<IProject> projects = getProjects(config);
|
final Collection<IProject> projects = getProjects(config);
|
||||||
if (BuildAction.isSaveAllSet()) {
|
if (BuildAction.isSaveAllSet()) {
|
||||||
saveEditors(projects);
|
saveEditors(projects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new Job("Building Active Configuration") {
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
try {
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
// Default, build the workspace
|
// Default, build the workspace
|
||||||
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
||||||
|
@ -104,6 +105,12 @@ public class BuildActiveCommandHandler extends AbstractHandler {
|
||||||
IncrementalProjectBuilder.INCREMENTAL_BUILD, true, monitor);
|
IncrementalProjectBuilder.INCREMENTAL_BUILD, true, monitor);
|
||||||
// TODO, may need to get the buildReferences argument from the descriptor
|
// TODO, may need to get the buildReferences argument from the descriptor
|
||||||
}
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return e.getStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.schedule();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue