The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+
If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
\ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launchbar.core/build.properties b/launch/org.eclipse.cdt.launchbar.core/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/launch/org.eclipse.cdt.launchbar.core/pom.xml b/launch/org.eclipse.cdt.launchbar.core/pom.xml
new file mode 100644
index 00000000000..56332a89815
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+
+ org.eclipse.cdt
+ cdt-parent
+ 8.4.0-SNAPSHOT
+ ../../pom.xml
+
+
+ 1.0.0-SNAPSHOT
+ org.eclipse.cdt.launchbar.core
+ eclipse-plugin
+
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchBarManager.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchBarManager.java
new file mode 100644
index 00000000000..e315b01c7d8
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchBarManager.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.ILaunchMode;
+
+public interface ILaunchBarManager extends IAdaptable {
+
+ ILaunchConfigurationDescriptor[] getLaunchConfigurationDescriptors();
+
+ ILaunchConfigurationDescriptor getActiveLaunchConfigurationDescriptor();
+
+ void setActiveLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException;
+
+ void addLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException;
+
+ void removeLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc);
+
+ ILaunchMode[] getLaunchModes() throws CoreException;
+
+ ILaunchMode getActiveLaunchMode();
+
+ void setActiveLaunchMode(ILaunchMode mode);
+
+ ILaunchTarget[] getLaunchTargets();
+
+ ILaunchTarget getActiveLaunchTarget();
+
+ void setActiveLaunchTarget(ILaunchTarget target);
+
+ void addLaunchTarget(ILaunchTarget target);
+
+ void removeLaunchTarget(ILaunchTarget target);
+
+ interface Listener {
+
+ void activeConfigurationDescriptorChanged();
+
+ void activeLaunchModeChanged();
+
+ void activeLaunchTargetChanged();
+
+ }
+
+ void addListener(Listener listener);
+
+ void removeListener(Listener listener);
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchConfigurationDescriptor.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchConfigurationDescriptor.java
new file mode 100644
index 00000000000..5cbfa8148d7
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchConfigurationDescriptor.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+
+public interface ILaunchConfigurationDescriptor {
+
+ /**
+ * Name to show in the launch configuration selector.
+ *
+ * @return name of the launch configuration
+ */
+ String getName();
+
+ /**
+ * The type of launch configuration supported by this descriptor.
+ *
+ * @return
+ */
+ ILaunchConfigurationType getLaunchConfigurationType() throws CoreException;
+
+ /**
+ * The corresponding launch configuration.
+ * If this launch config hasn't been created yet, it will be
+ *
+ * @return the corresponding launch configuration
+ * @throws CoreException
+ */
+ ILaunchConfiguration getLaunchConfiguration() throws CoreException;
+
+ /**
+ * Is this launch configuration managed by this descriptor.
+ *
+ * @param launchConfiguration
+ * @return
+ */
+ boolean matches(ILaunchConfiguration launchConfiguration);
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchConfigurationsProvider.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchConfigurationsProvider.java
new file mode 100644
index 00000000000..5d82ea37036
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchConfigurationsProvider.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core;
+
+/**
+ * Provides the list of launch configurations
+ *
+ */
+public interface ILaunchConfigurationsProvider {
+
+ /**
+ * Called after existing launch configs have been added. The provider
+ * can now add any more that they'd like to have.
+ */
+ void init(ILaunchBarManager manager);
+
+ /**
+ * If the provider has a better descriptor than the suggested one, return a better one.
+ * Otherwise, return the one that was passed in.
+ *
+ * @param descriptor candidate descriptor
+ * @return the best descriptor
+ */
+ ILaunchConfigurationDescriptor filterDescriptor(ILaunchConfigurationDescriptor descriptor);
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchTarget.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchTarget.java
new file mode 100644
index 00000000000..4fb64f5f57c
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchTarget.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core;
+
+public interface ILaunchTarget {
+
+ String getName();
+
+ ILaunchTargetType getType();
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchTargetType.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchTargetType.java
new file mode 100644
index 00000000000..d02451e0613
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/ILaunchTargetType.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core;
+
+public interface ILaunchTargetType {
+
+ String getId();
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/Activator.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/Activator.java
new file mode 100644
index 00000000000..3cabf156002
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/Activator.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core.internal;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+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.core.runtime.jobs.Job;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+
+ public static final String PLUGIN_ID = "org.eclipse.cdt.launchbar.core";
+ private static BundleContext context;
+ private LaunchBarManager launchBarManager;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+
+ bundleContext.registerService(ILaunchBarManager.class, new ServiceFactory() {
+ @Override
+ public synchronized ILaunchBarManager getService(Bundle bundle, ServiceRegistration registration) {
+ if (launchBarManager == null) {
+ launchBarManager = new LaunchBarManager();
+ new Job("Init LaunchBar Manager") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ launchBarManager.init();
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ }.schedule();;
+ }
+ return launchBarManager;
+ }
+
+ @Override
+ public synchronized void ungetService(Bundle bundle,
+ ServiceRegistration registration,
+ ILaunchBarManager service) {
+ }
+ }, null);
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ launchBarManager = null;
+ }
+
+ public static void throwCoreException(Exception e) throws CoreException {
+ throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e));
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/DefaultLaunchConfigurationDescriptor.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/DefaultLaunchConfigurationDescriptor.java
new file mode 100644
index 00000000000..367f54cdeba
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/DefaultLaunchConfigurationDescriptor.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core.internal;
+
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+
+public class DefaultLaunchConfigurationDescriptor implements ILaunchConfigurationDescriptor {
+
+ final ILaunchConfiguration config;
+
+ public DefaultLaunchConfigurationDescriptor(ILaunchConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ public String getName() {
+ return config.getName();
+ }
+
+ @Override
+ public ILaunchConfiguration getLaunchConfiguration() throws CoreException {
+ return config;
+ }
+
+ @Override
+ public ILaunchConfigurationType getLaunchConfigurationType() throws CoreException{
+ return config.getType();
+ }
+
+ @Override
+ public boolean matches(ILaunchConfiguration launchConfiguration) {
+ return config.equals(launchConfiguration);
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java
new file mode 100644
index 00000000000..3561e771972
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core.internal;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationsProvider;
+import org.eclipse.cdt.launchbar.core.ILaunchTarget;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchMode;
+
+public class LaunchBarManager extends PlatformObject implements ILaunchBarManager, ILaunchConfigurationListener {
+
+ private List listeners = new LinkedList<>();
+ private List providers = new ArrayList<>();
+ private Map configDescs = new HashMap<>();
+ private ILaunchConfigurationDescriptor activeConfigDesc;
+ private ILaunchMode[] launchModes;
+ private ILaunchMode activeLaunchMode;
+
+ private final LocalTargetType localTargetType = new LocalTargetType();
+
+ private static final String PREF_ACTIVE_CONFIG_DESC = "activeConfigDesc";
+ private static final String PREF_ACTIVE_LAUNCH_MODE = "activeLaunchMode";
+ private static final String PREF_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget";
+
+ private class ProviderExtensionDescriptor {
+ private ILaunchConfigurationsProvider provider;
+ private int priority;
+
+ public ProviderExtensionDescriptor(ILaunchConfigurationsProvider provider, int priority) {
+ super();
+ this.provider = provider;
+ this.priority = priority;
+ }
+
+ public ILaunchConfigurationsProvider getProvider() {
+ return provider;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ }
+
+ void init() throws CoreException {
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ Activator.PLUGIN_ID,
+ "launchConfigProvider");
+ for (IConfigurationElement element : elements) {
+ ILaunchConfigurationsProvider provider = (ILaunchConfigurationsProvider) element.createExecutableExtension("class");
+ String priorityString = element.getAttribute("priority");
+ int priority = 1; // Default is 1
+
+ if (priorityString != null) {
+ try {
+ priority = Integer.parseInt(priorityString);
+ } catch (NumberFormatException e) {
+ Activator.throwCoreException(e);
+ }
+ }
+
+ providers.add(new ProviderExtensionDescriptor(provider, priority));
+ }
+
+ Collections.sort(providers, new Comparator() {
+ @Override
+ public int compare(ProviderExtensionDescriptor o1, ProviderExtensionDescriptor o2) {
+ int p1 = o1.getPriority();
+ int p2 = o2.getPriority();
+ if (p1 > p2)
+ return 1;
+ else if (p1 < p2)
+ return -1;
+ else
+ return 0;
+ }
+ });
+
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ for (ILaunchConfiguration configuration : launchManager.getLaunchConfigurations()) {
+ launchConfigurationAdded(configuration);
+ }
+
+ for (ProviderExtensionDescriptor providerDesc : providers) {
+ providerDesc.getProvider().init(this);
+ }
+
+ launchManager.addLaunchConfigurationListener(this);
+
+ // Load up the active from the preferences or pick reasonable defaults
+ IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ String activeConfigDescName = store.get(PREF_ACTIVE_CONFIG_DESC, null);
+ if (activeConfigDescName == null && !configDescs.isEmpty()) {
+ activeConfigDescName = configDescs.values().iterator().next().getName();
+ }
+
+ if (activeConfigDescName != null) {
+ ILaunchConfigurationDescriptor configDesc = configDescs.get(activeConfigDescName);
+ if (configDesc != null) {
+ setActiveLaunchConfigurationDescriptor(configDesc);
+ }
+ }
+ }
+
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ ILaunchConfigurationDescriptor configDesc = new DefaultLaunchConfigurationDescriptor(configuration);
+ for (ProviderExtensionDescriptor provider : providers) {
+ configDesc = provider.getProvider().filterDescriptor(configDesc);
+ }
+ try {
+ addLaunchConfigurationDescriptor(configDesc);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public ILaunchConfigurationDescriptor[] getLaunchConfigurationDescriptors() {
+ ILaunchConfigurationDescriptor[] descs = configDescs.values().toArray(new ILaunchConfigurationDescriptor[configDescs.size()]);
+ Arrays.sort(descs, new Comparator() {
+ @Override
+ public int compare(ILaunchConfigurationDescriptor o1, ILaunchConfigurationDescriptor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+ return descs;
+ }
+
+ @Override
+ public ILaunchConfigurationDescriptor getActiveLaunchConfigurationDescriptor() {
+ return activeConfigDesc;
+ }
+
+ @Override
+ public void setActiveLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException {
+ if (activeConfigDesc == configDesc)
+ return;
+ activeConfigDesc = configDesc;
+
+ // Get the launch modes
+ List mymodes = new ArrayList<>();
+ ILaunchConfigurationType type = activeConfigDesc.getLaunchConfigurationType();
+ ILaunchMode[] modes = DebugPlugin.getDefault().getLaunchManager().getLaunchModes();
+ for (ILaunchMode mode : modes) {
+ if (type.supportsMode(mode.getIdentifier())) {
+ mymodes.add(mode);
+ }
+ }
+ launchModes = mymodes.toArray(new ILaunchMode[mymodes.size()]);
+
+ // Get the launch targets
+ // TODO
+
+ // Send notifications
+ for (Listener listener : listeners) {
+ listener.activeConfigurationDescriptorChanged();
+ }
+
+ // Set active mode
+ IEclipsePreferences store = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
+ String activeModeName = store.get(PREF_ACTIVE_LAUNCH_MODE, null);
+ boolean foundMode = false;
+ if (activeModeName != null) {
+ for (ILaunchMode mode : launchModes) {
+ if (activeModeName.equals(mode.getIdentifier())) {
+ setActiveLaunchMode(mode);
+ foundMode = true;
+ break;
+ }
+ }
+ }
+ if (!foundMode) {
+ if (launchModes.length > 0) {
+ ILaunchMode mode = getLaunchMode("debug");
+ if (mode == null) {
+ mode = getLaunchMode("run");
+ }
+ if (mode == null) {
+ mode = launchModes[0];
+ }
+ setActiveLaunchMode(mode);
+ } else {
+ setActiveLaunchMode(null);
+ }
+ }
+
+ }
+
+ @Override
+ public void addLaunchConfigurationDescriptor(ILaunchConfigurationDescriptor configDesc) throws CoreException {
+ configDescs.put(configDesc.getName(), configDesc);
+ setActiveLaunchConfigurationDescriptor(configDesc);
+ }
+
+ @Override
+ public void removeLaunchConfigurationDescriptor(
+ ILaunchConfigurationDescriptor configDesc) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public ILaunchMode[] getLaunchModes() throws CoreException {
+ return launchModes;
+ }
+
+ public ILaunchMode getLaunchMode(String id) {
+ for (ILaunchMode mode : launchModes)
+ if (id.equals(mode.getIdentifier()))
+ return mode;
+ return null;
+ }
+
+ @Override
+ public ILaunchMode getActiveLaunchMode() {
+ return activeLaunchMode;
+ }
+
+ @Override
+ public void setActiveLaunchMode(ILaunchMode mode) {
+ if (activeLaunchMode == mode)
+ return;
+ activeLaunchMode = mode;
+ for (Listener listener : listeners)
+ listener.activeLaunchModeChanged();
+ }
+
+ @Override
+ public ILaunchTarget[] getLaunchTargets() {
+ // TODO for reals
+ return new ILaunchTarget[] { localTargetType.getTarget() };
+ }
+
+ @Override
+ public ILaunchTarget getActiveLaunchTarget() {
+ // TODO for reals
+ return localTargetType.getTarget();
+ }
+
+ @Override
+ public void setActiveLaunchTarget(ILaunchTarget target) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addLaunchTarget(ILaunchTarget target) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeLaunchTarget(ILaunchTarget target) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addListener(Listener listener) {
+ listeners.add(listener);
+ }
+
+ @Override
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LocalTarget.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LocalTarget.java
new file mode 100644
index 00000000000..f51b98367df
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LocalTarget.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core.internal;
+
+import org.eclipse.cdt.launchbar.core.ILaunchTarget;
+import org.eclipse.cdt.launchbar.core.ILaunchTargetType;
+
+public class LocalTarget implements ILaunchTarget {
+
+ private final LocalTargetType type;
+
+ public LocalTarget(LocalTargetType type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getName() {
+ return "Local Machine";
+ }
+
+ @Override
+ public ILaunchTargetType getType() {
+ return type;
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LocalTargetType.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LocalTargetType.java
new file mode 100644
index 00000000000..c289f9f7ce7
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LocalTargetType.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.core.internal;
+
+import org.eclipse.cdt.launchbar.core.ILaunchTargetType;
+
+public class LocalTargetType implements ILaunchTargetType {
+
+ private final LocalTarget target;
+
+ public LocalTargetType() {
+ target = new LocalTarget(this);
+ }
+
+ @Override
+ public String getId() {
+ return "org.eclipse.cdt.launchbar.target.local";
+ }
+
+ public LocalTarget getTarget() {
+ return target;
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/.classpath b/launch/org.eclipse.cdt.launchbar.ui/.classpath
new file mode 100644
index 00000000000..098194ca4b7
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/launch/org.eclipse.cdt.launchbar.ui/.project b/launch/org.eclipse.cdt.launchbar.ui/.project
new file mode 100644
index 00000000000..d7d41664d66
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.cdt.launchbar.ui
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/launch/org.eclipse.cdt.launchbar.ui/.settings/org.eclipse.jdt.core.prefs b/launch/org.eclipse.cdt.launchbar.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f42de363afa
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/launch/org.eclipse.cdt.launchbar.ui/META-INF/MANIFEST.MF b/launch/org.eclipse.cdt.launchbar.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..a457822e466
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LaunchBar UI
+Bundle-SymbolicName: org.eclipse.cdt.launchbar.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.launchbar.ui.internal.Activator
+Bundle-Vendor: Eclipse CDT
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.e4.ui.workbench,
+ org.eclipse.e4.ui.model.workbench,
+ org.eclipse.e4.core.di,
+ org.eclipse.e4.core.services,
+ org.eclipse.osgi.services,
+ org.eclipse.cdt.launchbar.core,
+ org.eclipse.debug.ui,
+ org.eclipse.ui.workbench,
+ org.eclipse.ui.ide
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
diff --git a/launch/org.eclipse.cdt.launchbar.ui/about.html b/launch/org.eclipse.cdt.launchbar.ui/about.html
new file mode 100644
index 00000000000..d7c511887d6
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/about.html
@@ -0,0 +1,24 @@
+
+
+About
+
+
+
About This Content
+
+
June 22, 2007
+
License
+
+
The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+
If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
\ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launchbar.ui/build.properties b/launch/org.eclipse.cdt.launchbar.ui/build.properties
new file mode 100644
index 00000000000..e9863e281ea
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/launch/org.eclipse.cdt.launchbar.ui/icons/build.png b/launch/org.eclipse.cdt.launchbar.ui/icons/build.png
new file mode 100755
index 00000000000..110cb3a6315
Binary files /dev/null and b/launch/org.eclipse.cdt.launchbar.ui/icons/build.png differ
diff --git a/launch/org.eclipse.cdt.launchbar.ui/icons/config_config.png b/launch/org.eclipse.cdt.launchbar.ui/icons/config_config.png
new file mode 100644
index 00000000000..c3b2ddc8887
Binary files /dev/null and b/launch/org.eclipse.cdt.launchbar.ui/icons/config_config.png differ
diff --git a/launch/org.eclipse.cdt.launchbar.ui/icons/launch.png b/launch/org.eclipse.cdt.launchbar.ui/icons/launch.png
new file mode 100644
index 00000000000..d704b703b71
Binary files /dev/null and b/launch/org.eclipse.cdt.launchbar.ui/icons/launch.png differ
diff --git a/launch/org.eclipse.cdt.launchbar.ui/icons/stop.png b/launch/org.eclipse.cdt.launchbar.ui/icons/stop.png
new file mode 100755
index 00000000000..b55b7c4e4c6
Binary files /dev/null and b/launch/org.eclipse.cdt.launchbar.ui/icons/stop.png differ
diff --git a/launch/org.eclipse.cdt.launchbar.ui/plugin.properties b/launch/org.eclipse.cdt.launchbar.ui/plugin.properties
new file mode 100644
index 00000000000..e9bd17fdcdc
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/plugin.properties
@@ -0,0 +1 @@
+launchToolBar.label = LaunchBar
diff --git a/launch/org.eclipse.cdt.launchbar.ui/plugin.xml b/launch/org.eclipse.cdt.launchbar.ui/plugin.xml
new file mode 100644
index 00000000000..923d75543e1
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/plugin.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/launch/org.eclipse.cdt.launchbar.ui/pom.xml b/launch/org.eclipse.cdt.launchbar.ui/pom.xml
new file mode 100644
index 00000000000..e3de1971408
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+
+ org.eclipse.cdt
+ cdt-parent
+ 8.4.0-SNAPSHOT
+ ../../pom.xml
+
+
+ 1.0.0-SNAPSHOT
+ org.eclipse.cdt.launchbar.ui
+ eclipse-plugin
+
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/IHoverProvider.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/IHoverProvider.java
new file mode 100644
index 00000000000..648154e36bc
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/IHoverProvider.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui;
+
+public interface IHoverProvider {
+
+ /**
+ * Display the hover item.
+ *
+ * @return true if hover item was displayed, otherwise false
+ */
+ public abstract boolean displayHover(Object element);
+
+ /**
+ * Dismiss the hover item.
+ *
+ * @param immediate
+ * if true, the hover item will be immediately dismissed, otherwise it may be be dismissed at a later time.
+ */
+ public abstract void dismissHover(Object element, boolean immediate);
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/ILaunchBarUIConstants.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/ILaunchBarUIConstants.java
new file mode 100644
index 00000000000..62dac23c719
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/ILaunchBarUIConstants.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui;
+
+public interface ILaunchBarUIConstants {
+
+ public static final String TARGET_NAME = "targetName";
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/Activator.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/Activator.java
new file mode 100644
index 00000000000..3bac94a2831
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/Activator.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.Parameterization;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.launchbar.ui"; //$NON-NLS-1$
+
+ // Images
+ public static final String IMG_BUTTON_BUILD = "build";
+ public static final String IMG_BUTTON_LAUNCH = "launch";
+ public static final String IMG_BUTTON_STOP = "stop";
+
+ // Command ids
+ public static final String CMD_BUILD = "org.eclipse.cdt.launchbar.ui.command.buildActive";
+ public static final String CMD_LAUNCH = "org.eclipse.cdt.launchbar.ui.command.launchActive";
+ public static final String CMD_STOP = "org.eclipse.cdt.launchbar.ui.command.stop";
+ public static final String CMD_CONFIG = "org.eclipse.cdt.launchbar.ui.command.configureActiveLaunch";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ ImageRegistry imageRegistry = getImageRegistry();
+ imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png"));
+ imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png"));
+ imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png"));
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public Image getImage(String id) {
+ return getImageRegistry().get(id);
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public static void runCommand(String commandId, String... params) {
+ final ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
+ .getService(ICommandService.class);
+ Command command = commandService.getCommand(commandId);
+ final Event trigger = new Event();
+ final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
+ .getService(IHandlerService.class);
+ ExecutionEvent executionEvent = handlerService.createExecutionEvent(command, trigger);
+ if (params.length == 0) {
+ try {
+ command.executeWithChecks(executionEvent);
+ } catch (OperationCanceledException e) {
+ // abort
+ } catch (Exception e) {
+ log(e);
+ }
+ } else {
+ try {
+ final Parameterization[] parameterizations = new Parameterization[params.length / 2];
+ for (int i = 0; i < params.length; i += 2) {
+ IParameter param = command.getParameter(params[i]);
+ Parameterization parm = new Parameterization(param, params[i + 1]);
+ parameterizations[i / 2] = parm;
+ }
+ ParameterizedCommand parmCommand = new ParameterizedCommand(command, parameterizations);
+ handlerService.executeCommand(parmCommand, null);
+ } catch (Exception e) {
+ log(e);
+ }
+ }
+ }
+
+ public static void log(CoreException e) {
+ plugin.getLog().log(e.getStatus());
+ }
+
+ public static void log(Exception e) {
+ plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e));
+ }
+
+ public static T getService(Class cls) {
+ BundleContext context = getDefault().getBundle().getBundleContext();
+ ServiceReference ref = context.getServiceReference(cls);
+ return ref != null ? context.getService(ref) : null;
+ }
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarInjector.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarInjector.java
new file mode 100644
index 00000000000..2dcc1ff85de
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarInjector.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal;
+
+import javax.inject.Inject;
+
+import org.eclipse.cdt.launchbar.ui.internal.controls.LaunchBarControl;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.SideValue;
+import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
+import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
+import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MToolControl;
+import org.eclipse.e4.ui.workbench.UIEvents;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+public class LaunchBarInjector {
+
+ @Inject
+ MApplication application;
+
+ @Inject
+ IEventBroker eventBroker;
+
+ @Execute
+ void execute() {
+ // Inject the toolbar into all top trims
+ for (MWindow window : application.getChildren()) {
+ if (window instanceof MTrimmedWindow) {
+ for (MTrimBar trimBar : ((MTrimmedWindow) window).getTrimBars()) {
+ if (trimBar.getSide() == SideValue.TOP) {
+ injectLaunchBar(trimBar);
+ }
+ }
+ }
+ }
+
+ // Watch for new trimmed windows and inject there too.
+ eventBroker.subscribe(UIEvents.TrimmedWindow.TOPIC_TRIMBARS, new EventHandler() {
+ @Override
+ public void handleEvent(Event event) {
+ if (!UIEvents.isADD(event))
+ return;
+ Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE);
+ if (newValue instanceof MTrimBar) {
+ MTrimBar trimBar = (MTrimBar) newValue;
+ if (trimBar.getSide() == SideValue.TOP)
+ injectLaunchBar(trimBar);
+ }
+ }
+ });
+ }
+
+ void injectLaunchBar(MTrimBar trimBar) {
+ // Skip if we're already there
+ for (MTrimElement trimElement : trimBar.getChildren())
+ if (LaunchBarControl.ID.equals(trimElement.getElementId()))
+ return;
+
+ MToolControl launchBar = MMenuFactory.INSTANCE.createToolControl();
+ launchBar.setElementId(LaunchBarControl.ID);
+ launchBar.setContributionURI(LaunchBarControl.CLASS_URI);
+ trimBar.getChildren().add(0, launchBar);
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarUIManager.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarUIManager.java
new file mode 100644
index 00000000000..f100adf44fb
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarUIManager.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
+import org.eclipse.cdt.launchbar.core.ILaunchTarget;
+import org.eclipse.cdt.launchbar.ui.IHoverProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+public class LaunchBarUIManager {
+
+ ILaunchBarManager manager;
+
+ public LaunchBarUIManager(ILaunchBarManager manager) {
+ this.manager = manager;
+ }
+
+ public ILaunchBarManager getManager() {
+ return manager;
+ }
+
+ public ILabelProvider getLabelProvider(ILaunchConfigurationDescriptor configDesc) {
+ // TODO
+ return null;
+ }
+
+ public ILabelProvider getLabelProvider(ILaunchTarget target) {
+ // TODO
+ return null;
+ }
+
+ public String getEditCommand(ILaunchTarget target) {
+ // TODO
+ return null;
+ }
+
+ public IHoverProvider getHoverProvider(ILaunchTarget target) {
+ // TODO
+ return null;
+ }
+
+ public String getAddTargetCommand(ILaunchConfigurationDescriptor configDesc) {
+ // TODO
+ return null;
+ }
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarUIManagerAdapterFactory.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarUIManagerAdapterFactory.java
new file mode 100644
index 00000000000..338ec3a55c4
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/LaunchBarUIManagerAdapterFactory.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+import org.eclipse.core.runtime.IAdapterFactory;
+
+public class LaunchBarUIManagerAdapterFactory implements IAdapterFactory {
+
+ private static Map uiProvider = new HashMap<>();
+
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ILaunchBarManager && adapterType.equals(LaunchBarUIManager.class)) {
+ ILaunchBarManager manager = (ILaunchBarManager) adaptableObject;
+ LaunchBarUIManager uiManager = uiProvider.get(manager);
+ if (uiManager == null) {
+ uiManager = new LaunchBarUIManager(manager);
+ uiProvider.put(manager, uiManager);
+ }
+ return uiManager;
+ }
+ return null;
+ }
+
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { LaunchBarUIManager.class };
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/Messages.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/Messages.java
new file mode 100644
index 00000000000..be81078ed7b
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/Messages.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.launchbar.ui.internal.messages"; //$NON-NLS-1$
+ public static String LaunchBarControl_Build;
+ public static String LaunchBarControl_Launch;
+ public static String LaunchBarControl_Stop;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/BuildActiveCommandHandler.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/BuildActiveCommandHandler.java
new file mode 100644
index 00000000000..0659fcb8c4f
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/BuildActiveCommandHandler.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal.commands;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
+import org.eclipse.cdt.launchbar.ui.internal.Activator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+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.core.runtime.jobs.Job;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.BuildAction;
+import org.eclipse.ui.ide.ResourceUtil;
+import org.eclipse.ui.progress.UIJob;
+
+/**
+ * Build active project
+ */
+public class BuildActiveCommandHandler extends AbstractHandler {
+
+ private final ILaunchBarManager launchBarManager;
+
+ public BuildActiveCommandHandler() {
+ launchBarManager = Activator.getService(ILaunchBarManager.class);
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ new UIJob(Display.getDefault(), "Building Active Configuration") {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ final ILaunchConfigurationDescriptor desc = launchBarManager.getActiveLaunchConfigurationDescriptor();
+
+ if (desc == null) {
+ // popout - No launch configuration
+// showConfigurationErrorCallOut(NLS.bind("{0}\n{1}", Messages.RunActiveCommandHandler_No_Launch_Configuration_Selected,
+// Messages.RunActiveCommandHanlder_Create_Launch_Configuration));
+ }
+
+ new Job("Building Active Configuration") {
+ @Override
+ public boolean belongsTo(Object family) {
+ return ResourcesPlugin.FAMILY_MANUAL_BUILD.equals(family);
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (desc == null) {
+ ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
+ return Status.OK_STATUS;
+ }
+
+ ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
+
+ ILaunchConfiguration config = desc.getLaunchConfiguration();
+ Collection projects = getProjects(config);
+
+ if (BuildAction.isSaveAllSet()) {
+ saveEditors(projects);
+ }
+
+ String mode = launchMode.getIdentifier();
+ Set modes = new HashSet<>();
+ modes.add(mode);
+ ILaunchDelegate delegate = config.getType().getPreferredDelegate(modes);
+ if (delegate == null)
+ delegate = config.getType().getDelegates(modes)[0];
+ ILaunchConfigurationDelegate configDel = delegate.getDelegate();
+ if (configDel instanceof ILaunchConfigurationDelegate2) {
+ ILaunchConfigurationDelegate2 configDel2 = (ILaunchConfigurationDelegate2)configDel;
+ boolean ret;
+ ret = configDel2.preLaunchCheck(config, mode, monitor);
+ if (!ret)
+ return Status.CANCEL_STATUS;
+ if (!configDel2.buildForLaunch(config, mode, monitor))
+ return Status.OK_STATUS;
+ }
+
+ // Fall through, do a normal build
+ if (projects.isEmpty()) {
+ ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
+ } else {
+ Collection buildConfigs = getBuildConfigs(projects);
+ ResourcesPlugin.getWorkspace().build(buildConfigs.toArray(new IBuildConfiguration[buildConfigs.size()]),
+ IncrementalProjectBuilder.INCREMENTAL_BUILD, true, monitor);
+ // TODO, may need to get the buildReferences argument from the descriptor
+ }
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+
+ return Status.OK_STATUS;
+ };
+ }.schedule();
+
+ return Status.OK_STATUS;
+ }
+
+ protected Collection getProjects(ILaunchConfiguration config) {
+ Set projects = new HashSet<>();
+
+ IResource[] mappedResources;
+ try {
+ mappedResources = config.getMappedResources();
+ } catch (CoreException e) {
+ return projects;
+ }
+ if (mappedResources != null) {
+ for (IResource resource : mappedResources) {
+ IProject project = resource.getProject();
+ if (projects.contains(project))
+ continue;
+ projects.add(project);
+ try {
+ projects.addAll(Arrays.asList(project.getReferencedProjects()));
+ } catch (CoreException e) {
+ // skip
+ }
+ }
+ }
+
+ return projects;
+ }
+
+ protected Collection getBuildConfigs(Collection projects) {
+ Set configs = new HashSet<>();
+
+ for (IProject project : projects) {
+ try {
+ configs.add(project.getActiveBuildConfig());
+ } catch (CoreException e) {
+ // skip
+ }
+ }
+
+ return configs;
+ }
+
+ protected void saveEditors(final Collection projects) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (IWorkbenchWindow window : windows) {
+ IWorkbenchPage[] pages = window.getPages();
+ for (IWorkbenchPage page : pages) {
+ if (projects.isEmpty()) {
+ page.saveAllEditors(false);
+ } else {
+ IEditorPart[] editors = page.getDirtyEditors();
+ for (IEditorPart editor : editors) {
+ IFile inputFile = ResourceUtil.getFile(editor.getEditorInput());
+ if (inputFile != null) {
+ if (projects.contains(inputFile.getProject())) {
+ page.saveEditor(editor, false);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/ConfigureActiveLaunchHandler.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/ConfigureActiveLaunchHandler.java
new file mode 100644
index 00000000000..16b87bb28f6
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/ConfigureActiveLaunchHandler.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal.commands;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
+import org.eclipse.cdt.launchbar.ui.internal.Activator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchGroup;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class ConfigureActiveLaunchHandler extends AbstractHandler {
+
+ private final ILaunchBarManager launchBarManager;
+
+ public ConfigureActiveLaunchHandler() {
+ launchBarManager = Activator.getService(ILaunchBarManager.class);
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ILaunchConfigurationDescriptor activeLaunchConfiguration = launchBarManager.getActiveLaunchConfigurationDescriptor();
+ ILaunchMode activeLaunchMode = launchBarManager.getActiveLaunchMode();
+
+ if (activeLaunchConfiguration == null)
+ return Status.OK_STATUS;
+
+ ILaunchConfiguration launchConfiguration;
+ try {
+ launchConfiguration = activeLaunchConfiguration.getLaunchConfiguration();
+ } catch (CoreException e1) {
+ return e1.getStatus();
+ }
+
+ try {
+ ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy();
+ // TODO, gah, this is internal. Get it added to DebugUIUtil
+ ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(launchConfiguration.getType(), activeLaunchMode.getIdentifier());
+
+ if (DebugUITools.openLaunchConfigurationPropertiesDialog(HandlerUtil.getActiveShell(event), wc, group.getIdentifier()) == Window.OK)
+ wc.doSave();
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ protected String getMode() {
+ return "config"; //$NON-NLS-1$
+ }
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/LaunchActiveCommandHandler.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/LaunchActiveCommandHandler.java
new file mode 100644
index 00000000000..d28002cc4f9
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/LaunchActiveCommandHandler.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal.commands;
+
+import org.eclipse.cdt.launchbar.core.ILaunchBarManager;
+import org.eclipse.cdt.launchbar.core.ILaunchConfigurationDescriptor;
+import org.eclipse.cdt.launchbar.core.ILaunchTarget;
+import org.eclipse.cdt.launchbar.ui.internal.Activator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.ILaunchMode;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.progress.UIJob;
+
+public class LaunchActiveCommandHandler extends AbstractHandler {
+
+ private final ILaunchBarManager launchBarManager;
+
+ public LaunchActiveCommandHandler() {
+ launchBarManager = Activator.getService(ILaunchBarManager.class);
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ new UIJob(Display.getDefault(), "Launching Active Configuration") {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ try {
+ ILaunchConfigurationDescriptor desc = launchBarManager.getActiveLaunchConfigurationDescriptor();
+
+ if (desc == null) {
+ // popout - No launch configuration
+// showConfigurationErrorCallOut(NLS.bind("{0}\n{1}", Messages.RunActiveCommandHandler_No_Launch_Configuration_Selected,
+// Messages.RunActiveCommandHanlder_Create_Launch_Configuration));
+ return Status.OK_STATUS;
+ }
+
+ ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
+ ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
+
+ if (target == null) {
+ // popout - No target
+// if (TargetCorePlugin.getDefault().getTargetRegistry().getTargets().length == 1) {
+// showTargetErrorCallOut(NLS.bind("{0}{1}", Messages.RunActiveCommandHandler_Cannot, getMode(launchMode)),
+// DeviceErrors.Error.NO_DEVICES, Messages.RunActiveCommandHandler_Select_Manage_Devices);
+// } else { // Don't think this can occur. Leaving just in case.
+// showTargetErrorCallOut(NLS.bind("{0}{1}", Messages.RunActiveCommandHandler_Cannot, getMode(launchMode)),
+// DeviceErrors.Error.NO_ACTIVE, Messages.RunActiveCommandHandler_Select_Device_Or_Simulator);
+// }
+ return Status.OK_STATUS;
+ }
+
+ DebugUITools.launch(desc.getLaunchConfiguration(), launchMode.getIdentifier());
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ return Status.OK_STATUS;
+ };
+ }.schedule();
+
+ return Status.OK_STATUS;
+ }
+
+ protected void showConfigurationErrorCallOut(final String error) {
+// Control activeProjectControl = LaunchToolBar.getInstance().getActiveConfigurationControl();
+// showErrorToolTipOnControl(error, activeProjectControl);
+ }
+
+// protected void showTargetErrorCallOut(final String title, DeviceErrors.Error e, String action) {
+// Control activeTargetControl = LaunchToolBar.getInstance().getActiveTargetControl();
+// DeviceErrors.showCallOutErrorOnControl(activeTargetControl, title, e, action);
+// }
+
+ public static void showErrorToolTipOnControl(final String error, Control activeProjectControl) {
+// CalloutError tip = new CalloutError();
+// tip.setTarget(activeProjectControl);
+// tip.setHook(Position.BOTTOM_CENTER, Position.TOP_CENTER, new Point(0, 0));
+// tip.setData(error);
+// tip.show();
+ }
+
+ protected String getMode(ILaunchMode launchMode) {
+ return launchMode.getIdentifier(); //$NON-NLS-1$
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/StopActiveCommandHandler.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/StopActiveCommandHandler.java
new file mode 100644
index 00000000000..1f379175905
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/commands/StopActiveCommandHandler.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+public class StopActiveCommandHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // TODO
+ return null;
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/controls/CButton.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/controls/CButton.java
new file mode 100644
index 00000000000..e0961bbef09
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/controls/CButton.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal.controls;
+
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+
+public class CButton extends Canvas {
+
+ private boolean inButton;
+ private Image hotImage;
+ private Image coldImage;
+
+ public CButton(Composite parent, int style) {
+ super(parent, style);
+
+ addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ if (inButton) {
+ if (hotImage != null) {
+ e.gc.drawImage(hotImage, 0, 0);
+ } else if (coldImage != null) {
+ e.gc.drawImage(coldImage, 0, 0);
+ }
+ } else {
+ if (coldImage != null) {
+ e.gc.drawImage(coldImage, 0, 0);
+ } else if (hotImage != null) {
+ e.gc.drawImage(hotImage, 0, 0);
+ }
+ }
+ }
+ });
+
+ addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ inButton = true;
+ redraw();
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ inButton = false;
+ redraw();
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+
+ if (hotImage != null)
+ hotImage.dispose();
+
+ if (coldImage != null)
+ coldImage.dispose();
+ }
+
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ int width = 0;
+ int height = 0;
+ if (hotImage != null) {
+ Rectangle bounds = hotImage.getBounds();
+ width = bounds.width;
+ height = bounds.height;
+ }
+ if (coldImage != null) {
+ Rectangle bounds = coldImage.getBounds();
+ if (bounds.width > width)
+ width = bounds.width;
+ if (bounds.height > height)
+ height = bounds.height;
+ }
+ return new Point(width, height);
+ }
+
+ public void setHotImage(Image image) {
+ this.hotImage = image;
+ }
+
+ public void setColdImage(Image image) {
+ this.coldImage = image;
+ }
+
+}
diff --git a/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/controls/CSelector.java b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/controls/CSelector.java
new file mode 100644
index 00000000000..b54cbe86c90
--- /dev/null
+++ b/launch/org.eclipse.cdt.launchbar.ui/src/org/eclipse/cdt/launchbar/ui/internal/controls/CSelector.java
@@ -0,0 +1,854 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Doug Schaefer
+ *******************************************************************************/
+package org.eclipse.cdt.launchbar.ui.internal.controls;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.cdt.launchbar.ui.IHoverProvider;
+import org.eclipse.cdt.launchbar.ui.internal.Activator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.LineAttributes;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+public class CSelector extends Composite implements ISelectionProvider {
+
+ private IStructuredContentProvider contentProvider;
+ private ILabelProvider labelProvider;
+ private IHoverProvider hoverProvider;
+ private Comparator