diff options
author | Alexander Fedorov | 2019-07-02 07:54:47 +0000 |
---|---|---|
committer | Paul Pazderski | 2019-07-05 10:38:18 +0000 |
commit | 324f7342257c184b49912010121da919ef076060 (patch) | |
tree | 7a44a78c858b52b9f9f7e6567087f30205b3c816 | |
parent | 9af85f069eb2845cb5e7a7d2cda8f3e32d8ba6a2 (diff) | |
download | eclipse.platform.debug-324f7342257c184b49912010121da919ef076060.tar.gz eclipse.platform.debug-324f7342257c184b49912010121da919ef076060.tar.xz eclipse.platform.debug-324f7342257c184b49912010121da919ef076060.zip |
Bug 529651 - Launch group launches do not build before launch
Launch group delegates the build flag resolution to IStatusHandler that
reads the IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH preference
Change-Id: If8c6b1bbf0987279228e89edfd76e36157f097c2
Signed-off-by: Alexander Fedorov <alexander.fedorov@arsysop.ru>
3 files changed, 54 insertions, 2 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java index 66b92886b..6a5c79613 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 QNX Software Systems and others. + * Copyright (c) 2009, 2019 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -12,6 +12,7 @@ * QNX Software Systems - initial API and implementation * Freescale Semiconductor * SSI Schaefer + * Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 529651 *******************************************************************************/ package org.eclipse.debug.internal.core.groups; @@ -58,6 +59,8 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat public static final int CODE_GROUP_LAUNCH_START = 233; public static final int CODE_GROUP_LAUNCH_DONE = 234; + private static final int CODE_BUILD_BEFORE_LAUNCH = 206; + private static final String NAME_PROP = "name"; //$NON-NLS-1$ private static final String ENABLED_PROP = "enabled"; //$NON-NLS-1$ private static final String ADOPT_PROP = "adoptIfRunning"; //$NON-NLS-1$ @@ -75,6 +78,8 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat private static final Status GROUP_LAUNCH_START = new Status(IStatus.INFO, DEBUG_CORE, CODE_GROUP_LAUNCH_START, IInternalDebugCoreConstants.EMPTY_STRING, null); private static final Status GROUP_LAUNCH_DONE = new Status(IStatus.INFO, DEBUG_CORE, CODE_GROUP_LAUNCH_DONE, IInternalDebugCoreConstants.EMPTY_STRING, null); + private static final Status BUILD_BEFORE_LAUNCH = new Status(IStatus.INFO, DEBUG_CORE, CODE_BUILD_BEFORE_LAUNCH, IInternalDebugCoreConstants.EMPTY_STRING, null); + @Override public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException { return new GroupLaunch(configuration, mode); @@ -152,7 +157,17 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat ILaunch subLaunch = running.stream().findFirst().orElse(null); boolean launched = false; if (subLaunch == null) { - subLaunch = child.launch(localMode, monitor); + boolean build = true;// see DebugUIPreferenceInitializer + IStatusHandler buildHandler = DebugPlugin.getDefault().getStatusHandler(BUILD_BEFORE_LAUNCH); + try { + Object resolution = buildHandler.handleStatus(BUILD_BEFORE_LAUNCH, child); + if (resolution instanceof Boolean) { + build = ((Boolean) resolution).booleanValue(); + } + } catch (Exception e) { + // ignore and use default + } + subLaunch = child.launch(localMode, monitor, build); launched = true; } diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 2c6264e83..980f9bca9 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -15,6 +15,7 @@ Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956) Patrick Chuong (Texas Instruments) - Move debug toolbar actions to main window (Bug 332784) Axel Richard (Obeo) - Bug 41353 - Launch configurations prototypes + Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 529651 - Launch group launches do not build before launch --> <plugin> @@ -1711,6 +1712,12 @@ id="org.eclipse.debug.ui.groups.GroupLaunchHandler" plugin="org.eclipse.debug.core"> </statusHandler> + <statusHandler + class="org.eclipse.debug.internal.ui.BuildBeforeLaunchStatusHandler" + code="206" + id="org.eclipse.debug.ui.statusHandlers.BuildBeforeLaunch" + plugin="org.eclipse.debug.core"> + </statusHandler> </extension> <extension point="org.eclipse.debug.ui.launchGroups"> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BuildBeforeLaunchStatusHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BuildBeforeLaunchStatusHandler.java new file mode 100644 index 000000000..8fd45ffe8 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BuildBeforeLaunchStatusHandler.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2019 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov <alexander.fedorov@arsysop.ru> - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.debug.core.IStatusHandler; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.preference.IPreferenceStore; + +public class BuildBeforeLaunchStatusHandler implements IStatusHandler { + + @Override + public Object handleStatus(IStatus status, Object source) throws CoreException { + IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); + return Boolean.parseBoolean(store.getString(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH)); + } + +} |