Skip to content

Commit

Permalink
Launchbar build button always starts a build.
Browse files Browse the repository at this point in the history
Fixed the problem that the LaunchBar build button was not working when
auto build was disabled in the launch configuration.

Fixes #765
  • Loading branch information
ewaterlander committed Jun 4, 2024
1 parent 9f85daf commit 926a6e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions launchbar/org.eclipse.launchbar.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.launchbar.ui;singleton:=true
Bundle-Version: 2.5.400.qualifier
Bundle-Version: 2.5.500.qualifier
Bundle-Activator: org.eclipse.launchbar.ui.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.debug.ui,
org.eclipse.launchbar.core
org.eclipse.launchbar.core,
org.eclipse.cdt.debug.core;bundle-version="8.8.400"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.HashSet;
import java.util.Set;

import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
Expand All @@ -33,6 +34,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchDelegate;
import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
Expand Down Expand Up @@ -100,14 +102,20 @@ protected IStatus run(IProgressMonitor monitor) {
if (delegate == null)
delegate = config.getType().getDelegates(modes)[0];
ILaunchConfigurationDelegate configDel = delegate.getDelegate();
/* This build is started manually by pressing the LaunchBar build button.
* Always build, regardless if auto build is disabled in the launch configuration.
*/
ILaunchConfigurationWorkingCopy configCopy = config.copy(config.getName() + "Copy"); //$NON-NLS-1$
configCopy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH,
ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_ENABLED);
if (configDel instanceof ILaunchConfigurationTargetedDelegate) {
ILaunchConfigurationTargetedDelegate configDel2 = (ILaunchConfigurationTargetedDelegate) configDel;
boolean ret;
ret = configDel2.preLaunchCheck(config, mode, target, monitor);
if (!ret) {
return Status.CANCEL_STATUS;
}
if (!configDel2.buildForLaunch(config, mode, target, monitor)) {
if (!configDel2.buildForLaunch(configCopy, mode, target, monitor)) {
return Status.OK_STATUS;
}
} else if (configDel instanceof ILaunchConfigurationDelegate2) {
Expand All @@ -117,7 +125,8 @@ protected IStatus run(IProgressMonitor monitor) {
if (!ret) {
return Status.CANCEL_STATUS;
}
if (!configDel2.buildForLaunch(config, mode, monitor)) {

if (!configDel2.buildForLaunch(configCopy, mode, monitor)) {
return Status.OK_STATUS;
}
}
Expand Down

0 comments on commit 926a6e8

Please sign in to comment.