Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.application.product/debug.product3
-rw-r--r--debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF5
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.core/plugin.xml22
-rw-r--r--debug/org.eclipse.cdt.debug.core/pom.xml2
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java14
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLaunchDescriptorType.java35
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalLaunchConfigProvider.java109
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java126
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildProjectLaunchDescriptor.java48
-rw-r--r--debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml7
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CoreBuildLaunchLabelProvider.java37
14 files changed, 411 insertions, 9 deletions
diff --git a/debug/org.eclipse.cdt.debug.application.product/debug.product b/debug/org.eclipse.cdt.debug.application.product/debug.product
index cab34794d25..f243204b410 100644
--- a/debug/org.eclipse.cdt.debug.application.product/debug.product
+++ b/debug/org.eclipse.cdt.debug.application.product/debug.product
@@ -333,6 +333,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
<plugin id="org.eclipse.jface.databinding"/>
<plugin id="org.eclipse.jface.text"/>
<plugin id="org.eclipse.launchbar.core"/>
+ <plugin id="org.eclipse.launchbar.ui"/>
<plugin id="org.eclipse.ltk.core.refactoring"/>
<plugin id="org.eclipse.ltk.ui.refactoring"/>
<plugin id="org.eclipse.osgi"/>
@@ -347,10 +348,10 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
<plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/>
<plugin id="org.eclipse.team.core"/>
<plugin id="org.eclipse.team.ui"/>
+ <plugin id="org.eclipse.text"/>
<plugin id="org.eclipse.tm.terminal.control"/>
<plugin id="org.eclipse.tm.terminal.view.core"/>
<plugin id="org.eclipse.tm.terminal.view.ui"/>
- <plugin id="org.eclipse.text"/>
<plugin id="org.eclipse.tools.templates.core"/>
<plugin id="org.eclipse.tools.templates.ui"/>
<plugin id="org.eclipse.ui"/>
diff --git a/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
index 759817ce731..d2ca74a2f45 100644
--- a/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
-Bundle-Version: 8.0.0.qualifier
+Bundle-Version: 8.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -41,7 +41,8 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="[5.0.0,7.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.variables;bundle-version="3.2.0",
- org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)"
+ org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.launchbar.core;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.ibm.icu.text
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.properties b/debug/org.eclipse.cdt.debug.core/plugin.properties
index 5143875d060..13fc4ebc6e0 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.core/plugin.properties
@@ -24,6 +24,8 @@ AttachLaunch.name=C/C++ Attach to Application
PostMortemLaunch.name=C/C++ Postmortem Debugger
RemoteApplicationLaunch.name=C/C++ Remote Application
+localApplicationLaunch.name=C/C++ Local Application (auto)
+
CDebugger.name=C/C++ Development Tools Core Debugger Extension
BreakpointAction.name=Breakpoint Action Extension
SupportedSourceContainerTypes.name=C/C++ Supported Source Container Types Extension
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml
index bbbb4c5a6a5..65b5feba7fc 100644
--- a/debug/org.eclipse.cdt.debug.core/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.core/plugin.xml
@@ -461,4 +461,26 @@
type="org.eclipse.cdt.debug.core.cFunctionTracepointMarker">
</importParticipant>
</extension>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalRunLaunchDelegate"
+ id="org.eclipse.cdt.debug.core.localLaunchConfigurationType"
+ modes="run"
+ name="%localApplicationLaunch.name">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.launchbar.core.launchBarContributions">
+ <descriptorType
+ class="org.eclipse.cdt.debug.internal.core.launch.CoreBuildLaunchDescriptorType"
+ id="org.eclipse.cdt.debug.core.coreBuildDescriptorType"
+ priority="20">
+ </descriptorType>
+ <configProvider
+ class="org.eclipse.cdt.debug.internal.core.launch.CoreBuildLocalLaunchConfigProvider"
+ descriptorType="org.eclipse.cdt.debug.core.coreBuildDescriptorType"
+ priority="10">
+ </configProvider>
+ </extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.core/pom.xml b/debug/org.eclipse.cdt.debug.core/pom.xml
index 7bd571ce057..5a22c4af335 100644
--- a/debug/org.eclipse.cdt.debug.core/pom.xml
+++ b/debug/org.eclipse.cdt.debug.core/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>8.0.0-SNAPSHOT</version>
+ <version>8.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
index 177b245c5d1..78fd598077d 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java
@@ -46,6 +46,7 @@ import org.eclipse.debug.core.ILaunchDelegate;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* The plugin class for C/C++ debug core.
@@ -239,6 +240,15 @@ public class CDebugCorePlugin extends Plugin {
super.stop(context);
}
+ /**
+ * @since 8.1
+ */
+ public static <T> T getService(Class<T> service) {
+ BundleContext context = plugin.getBundle().getBundleContext();
+ ServiceReference<T> ref = context.getServiceReference(service);
+ return ref != null ? context.getService(ref) : null;
+ }
+
private void createCommandAdapterFactory() {
IAdapterManager manager= Platform.getAdapterManager();
CCommandAdapterFactory actionFactory = new CCommandAdapterFactory();
@@ -319,7 +329,7 @@ public class CDebugCorePlugin extends Plugin {
// Set the default launch delegates as early as possible, and do it only once (Bug 312997)
ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
- HashSet<String> debugSet = new HashSet<String>();
+ HashSet<String> debugSet = new HashSet<>();
debugSet.add(ILaunchManager.DEBUG_MODE);
ILaunchConfigurationType localCfg = launchMgr.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP);
@@ -378,7 +388,7 @@ public class CDebugCorePlugin extends Plugin {
} catch (CoreException e) {
}
- HashSet<String> runSet = new HashSet<String>();
+ HashSet<String> runSet = new HashSet<>();
runSet.add(ILaunchManager.RUN_MODE);
try {
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLaunchDescriptorType.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLaunchDescriptorType.java
new file mode 100644
index 00000000000..661a6e3c896
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLaunchDescriptorType.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.core.launch;
+
+import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.launchbar.core.ILaunchDescriptorType;
+import org.eclipse.launchbar.core.internal.Activator;
+
+/**
+ * The launch descriptor type for launch objects built with the Core Build System.
+ */
+public class CoreBuildLaunchDescriptorType implements ILaunchDescriptorType {
+
+ @Override
+ public ILaunchDescriptor getDescriptor(Object launchObject) throws CoreException {
+ if (launchObject instanceof IProject) {
+ // Make sure it's a new style build
+ IProject project = (IProject) launchObject;
+ if (Activator.getService(ICBuildConfigurationManager.class).supports(project)) {
+ return new CoreBuildProjectLaunchDescriptor(this, project);
+ }
+ }
+ // TODO IBinary
+ return null;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalLaunchConfigProvider.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalLaunchConfigProvider.java
new file mode 100644
index 00000000000..609bfa3e342
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalLaunchConfigProvider.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.core.launch;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.launchbar.core.AbstractLaunchConfigProvider;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.ILaunchTargetManager;
+
+public class CoreBuildLocalLaunchConfigProvider extends AbstractLaunchConfigProvider {
+
+ private static final String TYPE_ID = "org.eclipse.cdt.debug.core.localLaunchConfigurationType"; //$NON-NLS-1$
+
+ private Map<IProject, ILaunchConfiguration> configs = new HashMap<>();
+
+ @Override
+ public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
+ return ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId());
+ }
+
+ @Override
+ public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target)
+ throws CoreException {
+ return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(TYPE_ID);
+ }
+
+ @Override
+ public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target)
+ throws CoreException {
+ ILaunchConfiguration config = null;
+ IProject project = descriptor.getAdapter(IProject.class);
+ if (project != null) {
+ config = configs.get(project);
+ if (config == null) {
+ config = createLaunchConfiguration(descriptor, target);
+ // launch config added will get called below to add it to the
+ // configs map
+ }
+ }
+ return config;
+ }
+
+ @Override
+ protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target,
+ ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
+ super.populateLaunchConfiguration(descriptor, target, workingCopy);
+
+ // Set the project and the connection
+ IProject project = descriptor.getAdapter(IProject.class);
+ workingCopy.setMappedResources(new IResource[] { project });
+ }
+
+ @Override
+ public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
+ if (ownsLaunchConfiguration(configuration)) {
+ IProject project = configuration.getMappedResources()[0].getProject();
+ configs.put(project, configuration);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException {
+ for (Entry<IProject, ILaunchConfiguration> entry : configs.entrySet()) {
+ if (configuration.equals(entry.getValue())) {
+ configs.remove(entry.getKey());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
+ // TODO not sure I care
+ return false;
+ }
+
+ @Override
+ public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
+ IProject project = descriptor.getAdapter(IProject.class);
+ if (project != null) {
+ configs.remove(project);
+ }
+ }
+
+ @Override
+ public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
+ // nothing to do since the Local connection can't be removed
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
new file mode 100644
index 00000000000..e26692aa13a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildLocalRunLaunchDelegate.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.core.launch;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.utils.Platform;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;
+import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
+
+public class CoreBuildLocalRunLaunchDelegate extends LaunchConfigurationTargetedDelegate {
+
+ public static final String TYPE_ID = "org.eclipse.cdt.cmake.core.launchConfigurationType"; //$NON-NLS-1$
+
+ private ICBuildConfigurationManager configManager = CDebugCorePlugin.getService(ICBuildConfigurationManager.class);
+ private IToolChainManager tcManager = CDebugCorePlugin.getService(IToolChainManager.class);
+
+ private IProject getProject(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getMappedResources()[0].getProject();
+ }
+
+ @Override
+ public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target,
+ IProgressMonitor monitor) throws CoreException {
+ // Set active build config based on toolchain for target
+ Map<String, String> properties = new HashMap<>();
+ properties.put(IToolChain.ATTR_OS, Platform.getOS());
+ properties.put(IToolChain.ATTR_ARCH, Platform.getOSArch());
+ // TODO should really use real architecture of platform, not what Eclipse is using.
+ // Also on 64-bit platforms, try 32-bit if toolchains not found
+ Collection<IToolChain> tcs = tcManager.getToolChainsMatching(properties);
+ if (!tcs.isEmpty()) {
+ IToolChain toolChain = tcs.iterator().next();
+
+ IProject project = getProject(configuration);
+ ICBuildConfiguration config = configManager.getBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
+
+ if (config != null) {
+ IProjectDescription desc = project.getDescription();
+ desc.setActiveBuildConfig(config.getBuildConfiguration().getName());
+ project.setDescription(desc, monitor);
+ }
+ }
+
+ // proceed with the build
+ return superBuildForLaunch(configuration, mode, monitor);
+ }
+
+ @Override
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ IProject project = getProject(configuration);
+ ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
+
+ ICBuildConfiguration buildConfig = getBuildConfiguration(project, mode, target, monitor);
+ IBinary[] binaries = buildConfig.getBuildOutput();
+ IBinary exeFile = null;
+ for (IBinary binary : binaries) {
+ if (binary.isExecutable()) {
+ exeFile = binary;
+ break;
+ }
+ }
+ if (exeFile == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, "No binaries"));
+ }
+
+ try {
+ ProcessBuilder builder = new ProcessBuilder(Paths.get(exeFile.getLocationURI()).toString());
+ buildConfig.setBuildEnvironment(builder.environment());
+ Process process = builder.start();
+ DebugPlugin.newProcess(launch, process, exeFile.getPath().lastSegment());
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, "Error launching", e));
+ }
+ }
+
+ @Override
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
+ // 1. Extract project from configuration
+ // TODO dependencies too.
+ IProject project = getProject(configuration);
+ return new IProject[] { project };
+ }
+
+ private ICBuildConfiguration getBuildConfiguration(IProject project, String mode, ILaunchTarget target,
+ IProgressMonitor monitor) throws CoreException {
+ // Set active build config based on toolchain for target
+ Map<String, String> properties = new HashMap<>();
+ properties.put(IToolChain.ATTR_OS, Platform.getOS());
+ properties.put(IToolChain.ATTR_ARCH, Platform.getOSArch());
+ Collection<IToolChain> tcs = tcManager.getToolChainsMatching(properties);
+ if (!tcs.isEmpty()) {
+ IToolChain toolChain = tcs.iterator().next();
+ return configManager.getBuildConfiguration(project, toolChain, "run", monitor); //$NON-NLS-1$
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildProjectLaunchDescriptor.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildProjectLaunchDescriptor.java
new file mode 100644
index 00000000000..bfb4a223d96
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/launch/CoreBuildProjectLaunchDescriptor.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.core.launch;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.launchbar.core.ILaunchDescriptorType;
+
+/**
+ * A launch descriptor representing a project built with the new Core Build system.
+ */
+public class CoreBuildProjectLaunchDescriptor extends PlatformObject implements ILaunchDescriptor {
+
+ private final IProject project;
+ private final CoreBuildLaunchDescriptorType type;
+
+ public CoreBuildProjectLaunchDescriptor(CoreBuildLaunchDescriptorType type, IProject project) {
+ this.type = type;
+ this.project = project;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (IProject.class.equals(adapter)) {
+ return (T) project;
+ } else {
+ return super.getAdapter(adapter);
+ }
+ }
+
+ @Override
+ public String getName() {
+ return project.getName();
+ }
+
+ @Override
+ public ILaunchDescriptorType getType() {
+ return type;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index 88ba7a46921..b30629b0c42 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -50,14 +50,16 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.debug.ui;bundle-version="[3.7.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.7.0,4.0.0)",
- org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.1.0)",
+ org.eclipse.cdt.debug.core;bundle-version="[7.0.0,9.0.0)",
org.eclipse.cdt.ui;bundle-version="[6.0.0,7.0.0)",
org.eclipse.cdt.core;bundle-version="[5.0.0,7.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem,
- org.eclipse.core.expressions
+ org.eclipse.core.expressions,
+ org.eclipse.launchbar.core;bundle-version="2.0.0",
+ org.eclipse.launchbar.ui;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.ibm.icu.text
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index db15cf4be29..a2b3ff638b8 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -2560,5 +2560,12 @@
type="org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext">
</propertyTester>
</extension>
+ <extension
+ point="org.eclipse.launchbar.ui.launchBarUIContributions">
+ <descriptorUI
+ descriptorTypeId="org.eclipse.cdt.debug.core.coreBuildDescriptorType"
+ labelProvider="org.eclipse.cdt.debug.internal.ui.launch.CoreBuildLaunchLabelProvider">
+ </descriptorUI>
+ </extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
index a655d4ef78f..3e6f66031e4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
@@ -112,6 +112,7 @@ public class CDebugImages {
public static final String IMG_OBJS_PATH_MAP_ENTRY = NAME_PREFIX + "mapentry_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_COMMON_TAB = NAME_PREFIX + "common_tab.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_ARRAY_PARTITION = NAME_PREFIX + "arraypartition_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_C_APP = NAME_PREFIX + "c_app.gif"; //$NON-NLS-1$
public static final String IMG_LCL_TYPE_NAMES = NAME_PREFIX + "tnames_co.gif"; //$NON-NLS-1$
public static final String IMG_LCL_CHANGE_REGISTER_VALUE = NAME_PREFIX + "change_reg_value_co.gif"; //$NON-NLS-1$
@@ -206,6 +207,7 @@ public class CDebugImages {
public static final ImageDescriptor DESC_OBJS_COMMON_TAB = createManaged(T_OBJ, IMG_OBJS_COMMON_TAB);
public static final ImageDescriptor DESC_OBJS_ARRAY_PARTITION = createManaged(T_OBJ, IMG_OBJS_ARRAY_PARTITION);
public static final ImageDescriptor DESC_OBJS_DEBUGGER_CONSOLE_SELECT = createManaged(T_OBJ, IMG_DEBUGGER_CONSOLE_SELECT);
+ public static final ImageDescriptor DESC_OBJS_C_APP = createManaged(T_OBJ, IMG_OBJS_C_APP);
public static final ImageDescriptor DESC_WIZBAN_ADD_SOURCE = createManaged(T_WIZBAN, IMG_WIZBAN_ADD_SOURCE);
public static final ImageDescriptor DESC_WIZBAN_PATH_MAPPING = createManaged(T_WIZBAN, IMG_WIZBAN_PATH_MAPPING);
public static final ImageDescriptor DESC_WIZBAN_PATH_MAP_ENTRY = createManaged(T_WIZBAN, IMG_WIZBAN_PATH_MAP_ENTRY);
@@ -289,7 +291,7 @@ public class CDebugImages {
try {
ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
if (fgAvoidSWTErrorMap == null) {
- fgAvoidSWTErrorMap = new HashMap<String, ImageDescriptor>();
+ fgAvoidSWTErrorMap = new HashMap<>();
}
fgAvoidSWTErrorMap.put(name, result);
if (fgImageRegistry != null) {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CoreBuildLaunchLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CoreBuildLaunchLabelProvider.java
new file mode 100644
index 00000000000..b2ea7424410
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/CoreBuildLaunchLabelProvider.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.launch;
+
+import org.eclipse.cdt.debug.internal.ui.CDebugImages;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+public class CoreBuildLaunchLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof ILaunchDescriptor) {
+ return ((ILaunchDescriptor) element).getName();
+ } else {
+ return super.getText(element);
+ }
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof ILaunchDescriptor) {
+ // TODO different icon for binary
+ return CDebugUIPlugin.getDefault().getImage(CDebugImages.IMG_OBJS_C_APP, CDebugImages.DESC_OBJS_C_APP);
+ } else {
+ return super.getImage(element);
+ }
+ }
+
+}

Back to the top