Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-09-06 19:53:40 +0000
committerDoug Schaefer2017-09-07 19:52:28 +0000
commitc3f3da9f252ae49035fed78b11305c1aad22ccc4 (patch)
tree48cbe41e8f8669724ef8029baa0d1a4da7f34e4a /debug/org.eclipse.cdt.debug.ui/src
parent47fe12a1793f1ee5ba7f3b20dd7081a5be8466c0 (diff)
downloadorg.eclipse.cdt-c3f3da9f252ae49035fed78b11305c1aad22ccc4.tar.gz
org.eclipse.cdt-c3f3da9f252ae49035fed78b11305c1aad22ccc4.tar.xz
org.eclipse.cdt-c3f3da9f252ae49035fed78b11305c1aad22ccc4.zip
Core Build - add support for Generic target
Adapts to LaunchBar's new Build Tab extension. Change-Id: Icad41a7083f4389a546234d2835a9c4b60fa0eae
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetLabelProvider.java30
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java51
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java56
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java42
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java9
6 files changed, 190 insertions, 0 deletions
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 3e6f66031e4..f978c314a72 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
@@ -113,6 +113,7 @@ public class CDebugImages {
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_OBJS_CDT_LOGO = NAME_PREFIX + "cdt_logo_16.png"; //$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$
@@ -208,6 +209,7 @@ public class CDebugImages {
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_OBJS_CDT_LOGO = createManaged(T_OBJ, IMG_OBJS_CDT_LOGO);
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);
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetLabelProvider.java
new file mode 100644
index 00000000000..f681510e815
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetLabelProvider.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.jface.viewers.LabelProvider;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.swt.graphics.Image;
+
+public class GenericTargetLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof ILaunchTarget) {
+ return ((ILaunchTarget) element).getId();
+ }
+ return super.getText(element);
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return CDebugImages.get(CDebugImages.IMG_OBJS_CDT_LOGO);
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java
new file mode 100644
index 00000000000..bc5f6fd6892
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/GenericTargetPropertiesBlock.java
@@ -0,0 +1,51 @@
+package org.eclipse.cdt.debug.internal.ui.launch;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class GenericTargetPropertiesBlock extends Composite {
+
+ private Text nameText;
+ private Text osText;
+ private Text archText;
+
+ public GenericTargetPropertiesBlock(Composite parent, int style) {
+ super(parent, style);
+ setLayout(new GridLayout(2, false));
+
+ Label label = new Label(this, SWT.NONE);
+ label.setText("Name:");
+
+ nameText = new Text(this, SWT.BORDER);
+ nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ label = new Label(this, SWT.NONE);
+ label.setText("Operating System:");
+
+ osText = new Text(this, SWT.BORDER);
+ osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ label = new Label(this, SWT.NONE);
+ label.setText("CPU Architecture:");
+
+ archText = new Text(this, SWT.BORDER);
+ archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ }
+
+ public String getTargetName() {
+ return nameText.getText();
+ }
+
+ public String getOS() {
+ return osText.getText();
+ }
+
+ public String getArch() {
+ return archText.getText();
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java
new file mode 100644
index 00000000000..a8f982dc916
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizard.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.core.launch.GenericTargetTypeProvider;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.ILaunchTargetManager;
+import org.eclipse.launchbar.core.target.ILaunchTargetWorkingCopy;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+public class NewGenericTargetWizard extends Wizard implements INewWizard {
+
+ private NewGenericTargetWizardPage page;
+
+ public NewGenericTargetWizard() {
+ setWindowTitle("New Generic Target");
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // nothing
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ page = new NewGenericTargetWizardPage();
+ addPage(page);
+ }
+
+ @Override
+ public boolean performFinish() {
+ ILaunchTargetManager manager = CDebugUIPlugin.getService(ILaunchTargetManager.class);
+ String typeId = GenericTargetTypeProvider.TYPE_ID;
+ String id = page.getTargetName();
+
+ ILaunchTarget target = manager.addLaunchTarget(typeId, id);
+ ILaunchTargetWorkingCopy wc = target.getWorkingCopy();
+ wc.setAttribute(ILaunchTarget.ATTR_OS, page.getOS());
+ wc.setAttribute(ILaunchTarget.ATTR_ARCH, page.getArch());
+ wc.save();
+
+ return true;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java
new file mode 100644
index 00000000000..9f3f557d4f0
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/launch/NewGenericTargetWizardPage.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class NewGenericTargetWizardPage extends WizardPage {
+
+ private GenericTargetPropertiesBlock propertiesBlock;
+
+ public NewGenericTargetWizardPage() {
+ super(NewGenericTargetWizardPage.class.getName());
+ setTitle("Generic Target");
+ setDescription("Enter name and properties for the target.");
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ propertiesBlock = new GenericTargetPropertiesBlock(parent, SWT.NONE);
+ setControl(propertiesBlock);
+ }
+
+ public String getTargetName() {
+ return propertiesBlock.getTargetName();
+ }
+
+ public String getOS() {
+ return propertiesBlock.getOS();
+ }
+
+ public String getArch() {
+ return propertiesBlock.getArch();
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
index 5c6f93bfc81..6201198ce81 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
@@ -61,6 +61,7 @@ import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.WorkbenchJob;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* The main plugin class to be used in the desktop.
@@ -408,4 +409,12 @@ public class CDebugUIPlugin extends AbstractUIPlugin {
public static IDebuggerConsoleManager getDebuggerConsoleManager() {
return fDebuggerConsoleManager;
}
+
+ /** @since 8.3 */
+ 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;
+ }
+
}

Back to the top