1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Core Build - add support for Generic target

Adapts to LaunchBar's new Build Tab extension.

Change-Id: Icad41a7083f4389a546234d2835a9c4b60fa0eae
This commit is contained in:
Doug Schaefer 2017-09-06 15:53:40 -04:00
parent 47fe12a179
commit c3f3da9f25
29 changed files with 996 additions and 385 deletions

View file

@ -93,7 +93,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
Map<String, String> properties = getProperties();
String generator = properties.get(CMAKE_GENERATOR);
if (generator == null) {
generator = "Unix Makefiles"; //$NON-NLS-1$
generator = "Ninja"; //$NON-NLS-1$
}
project.deleteMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
@ -200,7 +200,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
String cleanCommand = properties.get(CLEAN_COMMAND);
if (cleanCommand == null) {
if (generator != null && generator.equals("Ninja")) { //$NON-NLS-1$
if (generator == null || generator.equals("Ninja")) { //$NON-NLS-1$
cleanCommand = "ninja clean"; //$NON-NLS-1$
} else {
cleanCommand = "make clean"; //$NON-NLS-1$

View file

@ -122,7 +122,7 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
}
private void updateGeneratorButtons(String generator) {
if (generator != null && generator.equals("Ninja")) { //$NON-NLS-1$
if (generator == null || generator.equals("Ninja")) { //$NON-NLS-1$
ninjaGenButton.setSelection(true);
} else {
unixGenButton.setSelection(true);
@ -133,9 +133,8 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
Map<String, String> properties = new HashMap<>();
if (ninjaGenButton.getSelection()) {
properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR, "Ninja"); //$NON-NLS-1$
}
properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR,
ninjaGenButton.getSelection() ? "Ninja" : "Unix Makefiles"); //$NON-NLS-1$ //$NON-NLS-2$
String cmakeArgs = cmakeArgsText.getText().trim();
if (!cmakeArgs.isEmpty()) {

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
Bundle-Version: 6.3.1.qualifier
Bundle-Version: 6.4.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -23,6 +23,8 @@ import org.eclipse.cdt.core.dom.ast.ITypedef;
public interface ICPPAliasTemplateInstance extends ITypedef, ICPPTemplateInstance {
/**
* Returns the alias template specialized by this instance.
*
* @since 6.4
*/
@Override
public ICPPAliasTemplate getTemplateDefinition();

View file

@ -26,6 +26,7 @@ import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.build.IToolChainManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IProject;
@ -314,6 +315,11 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
@Override
public boolean supports(IProject project) throws CoreException {
// Is this a CDT project?
if (!CoreModel.hasCNature(project)) {
return false;
}
initProviders();
// First see if we have a build config registered

View file

@ -124,11 +124,14 @@ public class ToolChainManager implements IToolChainManager {
for (IToolChain toolChain : toolChains.values()) {
boolean matches = true;
for (Map.Entry<String, String> property : properties.entrySet()) {
if (!property.getValue().equals(toolChain.getProperty(property.getKey()))) {
String tcProperty = toolChain.getProperty(property.getKey());
if (tcProperty != null) {
if (!property.getValue().equals(tcProperty)) {
matches = false;
break;
}
}
}
if (matches) {
tcs.add(toolChain);
}

View file

@ -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.2.0.qualifier
Bundle-Version: 8.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -25,6 +25,7 @@ PostMortemLaunch.name=C/C++ Postmortem Debugger
RemoteApplicationLaunch.name=C/C++ Remote Application
localApplicationLaunch.name=Auto C/C++ Local Application
genericLaunch.name=Auto Generic C/C++ Launch
CDebugger.name=C/C++ Development Tools Core Debugger Extension
BreakpointAction.name=Breakpoint Action Extension

View file

@ -471,6 +471,13 @@
public="false">
</launchConfigurationType>
</extension>
<extension
point="org.eclipse.launchbar.core.launchTargetTypes">
<launchTargetType
id="org.eclipse.cdt.launchTargetType.generic"
provider="org.eclipse.cdt.debug.core.launch.GenericTargetTypeProvider">
</launchTargetType>
</extension>
<extension
point="org.eclipse.launchbar.core.launchBarContributions">
<descriptorType
@ -483,5 +490,10 @@
descriptorType="org.eclipse.cdt.debug.core.coreBuildDescriptorType"
priority="10">
</configProvider>
<configProvider
class="org.eclipse.cdt.debug.internal.core.launch.CoreBuildGenericLaunchConfigProvider"
descriptorType="org.eclipse.cdt.debug.core.coreBuildDescriptorType"
priority="10">
</configProvider>
</extension>
</plugin>

View file

@ -0,0 +1,162 @@
/*******************************************************************************
* 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.core.launch;
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.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.launchbar.core.ILaunchBarListener;
import org.eclipse.launchbar.core.ILaunchBarManager;
import org.eclipse.launchbar.core.ILaunchDescriptor;
import org.eclipse.launchbar.core.target.ILaunchTarget;
/**
* A launchbar listener that attempts to set the active build configuration on
* the project adapted from the launch descriptor that supports the given
* target.
*
* @since 8.3
*/
public class CoreBuildLaunchBarTracker implements ILaunchBarListener {
private final ILaunchBarManager launchBarManager = CDebugCorePlugin.getService(ILaunchBarManager.class);
private final ICBuildConfigurationManager configManager = CDebugCorePlugin
.getService(ICBuildConfigurationManager.class);
private final IToolChainManager toolChainManager = CDebugCorePlugin.getService(IToolChainManager.class);
private final String targetTypeId;
public CoreBuildLaunchBarTracker(String targetTypeId) {
this.targetTypeId = targetTypeId;
}
private void setActiveBuildConfig(String mode, ILaunchDescriptor descriptor, ILaunchTarget target)
throws CoreException {
if (!targetTypeId.equals(target.getTypeId())) {
return;
}
IProject project = descriptor.getAdapter(IProject.class);
if (project == null) {
// Can we get the project name from the config
ILaunchConfiguration configuration = launchBarManager.getLaunchConfiguration(descriptor, target);
String projectName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
if (!projectName.isEmpty()) {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
}
if (project == null) {
// Try the mapped resources
IResource[] mappedResources = configuration.getMappedResources();
if (mappedResources != null && mappedResources.length > 0) {
project = mappedResources[0].getProject();
}
}
}
if (project == null || !configManager.supports(project)) {
return;
}
// Pick build config based on toolchain for target
Map<String, String> properties = new HashMap<>();
properties.putAll(target.getAttributes());
Collection<IToolChain> tcs = toolChainManager.getToolChainsMatching(properties);
if (!tcs.isEmpty()) {
IToolChain toolChain = tcs.iterator().next();
IProgressMonitor monitor = new NullProgressMonitor();
ICBuildConfiguration buildConfig = configManager.getBuildConfiguration(project, toolChain, mode,
new NullProgressMonitor());
if (buildConfig != null) {
IProjectDescription desc = project.getDescription();
desc.setActiveBuildConfig(buildConfig.getBuildConfiguration().getName());
project.setDescription(desc, monitor);
// Copy over the build attributes from the launch config
ILaunchConfiguration configuration = launchBarManager.getLaunchConfiguration(descriptor, target);
Map<String, String> buildProps = configuration.getAttribute(
CoreBuildLaunchConfigDelegate.getBuildAttributeName(mode),
buildConfig.getDefaultProperties());
buildConfig.setProperties(buildProps);
}
}
}
@Override
public void activeLaunchTargetChanged(ILaunchTarget target) {
try {
if (target == null || target.equals(ILaunchTarget.NULL_TARGET)) {
return;
}
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
if (launchMode == null) {
return;
}
String mode = launchMode.getIdentifier();
ILaunchDescriptor descriptor = launchBarManager.getActiveLaunchDescriptor();
setActiveBuildConfig(mode, descriptor, target);
} catch (CoreException e) {
CDebugCorePlugin.log(e.getStatus());
}
}
@Override
public void activeLaunchDescriptorChanged(ILaunchDescriptor descriptor) {
try {
if (descriptor == null) {
return;
}
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
if (launchMode == null) {
return;
}
String mode = launchMode.getIdentifier();
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
setActiveBuildConfig(mode, descriptor, target);
} catch (CoreException e) {
CDebugCorePlugin.log(e.getStatus());
}
}
@Override
public void activeLaunchModeChanged(ILaunchMode mode) {
try {
if (mode == null) {
return;
}
ILaunchDescriptor descriptor = launchBarManager.getActiveLaunchDescriptor();
ILaunchTarget target = launchBarManager.getActiveLaunchTarget();
setActiveBuildConfig(mode.getIdentifier(), descriptor, target);
} catch (CoreException e) {
CDebugCorePlugin.log(e.getStatus());
}
}
}

View file

@ -0,0 +1,33 @@
/*******************************************************************************
* 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.core.launch;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.launchbar.core.ILaunchBarManager;
import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.launchbar.core.target.ILaunchTargetManager;
import org.eclipse.launchbar.core.target.ILaunchTargetProvider;
import org.eclipse.launchbar.core.target.TargetStatus;
public class GenericTargetTypeProvider implements ILaunchTargetProvider {
public static final String TYPE_ID = "org.eclipse.cdt.launchTargetType.generic"; //$NON-NLS-1$
@Override
public void init(ILaunchTargetManager targetManager) {
ILaunchBarManager launchBarManager = CDebugCorePlugin.getService(ILaunchBarManager.class);
launchBarManager.addListener(new CoreBuildLaunchBarTracker(TYPE_ID));
}
@Override
public TargetStatus getStatus(ILaunchTarget target) {
// Always OK
return TargetStatus.OK_STATUS;
}
}

View file

@ -0,0 +1,150 @@
package org.eclipse.cdt.debug.internal.core.launch;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.launch.GenericTargetTypeProvider;
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 CoreBuildGenericLaunchConfigProvider extends AbstractLaunchConfigProvider {
private static final String TYPE_ID = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"; //$NON-NLS-1$
private static final String ATTR_OS = CDebugCorePlugin.PLUGIN_ID + ".target_os"; //$NON-NLS-1$
private static final String NO_OS = ""; //$NON-NLS-1$
private Map<IProject, Map<String, ILaunchConfiguration>> configs = new HashMap<>();
@Override
public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
return target.getTypeId().equals(GenericTargetTypeProvider.TYPE_ID);
}
@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) {
Map<String, ILaunchConfiguration> projectConfigs = configs.get(project);
if (projectConfigs == null) {
projectConfigs = new HashMap<>();
configs.put(project, projectConfigs);
}
String os = target.getAttribute(ILaunchTarget.ATTR_OS, NO_OS);
config = projectConfigs.get(os);
if (config == null) {
config = createLaunchConfiguration(descriptor, target);
}
}
return config;
}
@Override
protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target,
ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
super.populateLaunchConfiguration(descriptor, target, workingCopy);
// Set the project
IProject project = descriptor.getAdapter(IProject.class);
workingCopy.setMappedResources(new IResource[] { project });
// set the OS
String os = target.getAttribute(ILaunchTarget.ATTR_OS, NO_OS);
workingCopy.setAttribute(ATTR_OS, os);
}
@Override
public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
if (ownsLaunchConfiguration(configuration)) {
IProject project = configuration.getMappedResources()[0].getProject();
Map<String, ILaunchConfiguration> projectConfigs = configs.get(project);
if (projectConfigs == null) {
projectConfigs = new HashMap<>();
configs.put(project, projectConfigs);
}
String os = configuration.getAttribute(ATTR_OS, NO_OS);
projectConfigs.put(os, configuration);
return true;
}
return false;
}
@Override
public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException {
for (Entry<IProject, Map<String, ILaunchConfiguration>> projectEntry : configs.entrySet()) {
Map<String, ILaunchConfiguration> projectConfigs = projectEntry.getValue();
for (Entry<String, ILaunchConfiguration> entry : projectConfigs.entrySet()) {
if (configuration.equals(entry.getValue())) {
projectConfigs.remove(entry.getKey());
if (projectConfigs.isEmpty()) {
configs.remove(projectEntry.getKey());
}
return true;
}
}
}
return false;
}
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
// nothing to do
return false;
}
@Override
public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
IProject project = descriptor.getAdapter(IProject.class);
if (project != null) {
Map<String, ILaunchConfiguration> projectConfigs = configs.get(project);
if (projectConfigs != null) {
for (ILaunchConfiguration config : projectConfigs.values()) {
config.delete();
}
}
}
}
@Override
public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
// Any other targets have the same OS?
String os = target.getAttribute(ILaunchTarget.ATTR_OS, NO_OS);
ILaunchTargetManager targetManager = CDebugCorePlugin.getService(ILaunchTargetManager.class);
for (ILaunchTarget t : targetManager.getLaunchTargets()) {
if (!target.equals(t) && os.equals(t.getAttribute(ILaunchTarget.ATTR_OS, NO_OS))) {
// Yup, nothing to do then
return;
}
}
for (Entry<IProject, Map<String, ILaunchConfiguration>> projectEntry : configs.entrySet()) {
Map<String, ILaunchConfiguration> projectConfigs = projectEntry.getValue();
ILaunchConfiguration config = projectConfigs.get(os);
if (config != null) {
config.delete();
}
}
}
}

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui; singleton:=true
Bundle-Version: 8.2.0.qualifier
Bundle-Version: 8.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

View file

@ -277,3 +277,5 @@ popup.stepIntoSelection.name=Step Into Selection
# Debugger console view
DebuggerConsoleView.name=Debugger Console
GenericTarget.name=Generic Target

View file

@ -2579,5 +2579,18 @@
id="org.eclipse.cdt.debug.ui.localLaunchConfigurationTypeImage">
</launchConfigurationTypeImage>
</extension>
<extension
point="org.eclipse.launchbar.ui.launchTargetTypeUI">
<launchTargetTypeUI
id="org.eclipse.cdt.launchTargetType.generic"
labelProvider="org.eclipse.cdt.debug.internal.ui.launch.GenericTargetLabelProvider">
</launchTargetTypeUI>
<wizard
class="org.eclipse.cdt.debug.internal.ui.launch.NewGenericTargetWizard"
icon="icons/obj16/cdt_logo_16.png"
id="org.eclipse.cdt.debug.ui.newGenericTargetWizard"
name="%GenericTarget.name">
</wizard>
</extension>
</plugin>

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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();
}
}

View file

@ -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;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -155,4 +155,12 @@
type="org.eclipse.cdt.debug.core.localCoreBuildLaunchConfigType">
</launchConfigurationTabGroup>
</extension>
<extension
point="org.eclipse.launchbar.ui.launchBarUIContributions">
<buildTabGroup
launchConfigType="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"
launchDescriptorType="org.eclipse.cdt.debug.core.coreBuildDescriptorType"
tabGroup="org.eclipse.cdt.launch.internal.corebuild.CoreBuildTabGroup">
</buildTabGroup>
</extension>
</plugin>

View file

@ -0,0 +1,23 @@
/*******************************************************************************
* 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.launch.internal.corebuild;
import org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
public class CoreBuildTabGroup extends AbstractLaunchConfigurationTabGroup implements ILaunchConfigurationTabGroup {
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
setTabs(new ILaunchConfigurationTab[] { new CoreBuildTab() });
}
}

View file

@ -39,12 +39,14 @@ public class LaunchImages {
public static String IMG_VIEW_ENVIRONMENT_TAB = NAME_PREFIX + "environment_tab.gif"; //$NON-NLS-1$
public static String IMG_VIEW_DEBUGGER_TAB = NAME_PREFIX + "debugger_tab.gif"; //$NON-NLS-1$
public static String IMG_VIEW_SOURCE_TAB = NAME_PREFIX + "source_tab.gif"; //$NON-NLS-1$
public static String IMG_VIEW_CORE_BUILD_TAB = NAME_PREFIX + "core_build_tab.png"; //$NON-NLS-1$
public static final ImageDescriptor DESC_TAB_MAIN= createManaged(T_TABS, IMG_VIEW_MAIN_TAB);
public static final ImageDescriptor DESC_TAB_ARGUMENTS = createManaged(T_TABS, IMG_VIEW_ARGUMENTS_TAB);
public static final ImageDescriptor DESC_TAB_ENVIRONMENT = createManaged(T_TABS, IMG_VIEW_ENVIRONMENT_TAB);
public static final ImageDescriptor DESC_TAB_DEBUGGER = createManaged(T_TABS, IMG_VIEW_DEBUGGER_TAB);
public static final ImageDescriptor DESC_TAB_SOURCE = createManaged(T_TABS, IMG_VIEW_SOURCE_TAB);
public static final ImageDescriptor DESC_TAB_CORE_BUILD = createManaged(T_TABS, IMG_VIEW_CORE_BUILD_TAB);
public static String IMG_OBJS_EXEC= NAME_PREFIX + "exec_obj.gif"; //$NON-NLS-1$
public static final ImageDescriptor DESC_OBJS_EXEC = createManaged(T_OBJS, IMG_OBJS_EXEC);

View file

@ -49,7 +49,7 @@ LocalAttachLaunchDelegate_Platform_cannot_list_processes=Current platform does n
LocalAttachLaunchDelegate_Select_Process_to_attach_debugger_to=Select a Process to attach debugger to:
LocalAttachLaunchDelegate_CDT_Launch_Error=CDT Launch Error
CoreBuildTab_Build=Build
CoreBuildTab_Build=Build Settings
CoreBuildTab_NoOptions=No build options required.
CoreFileLaunchDelegate_Launching_postmortem_debugger=Launching postmortem debugger
CoreFileLaunchDelegate_No_Corefile_selected=No Corefile selected

View file

@ -7,6 +7,7 @@
*******************************************************************************/
package org.eclipse.cdt.launch.ui.corebuild;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.core.resources.IProject;
@ -21,6 +22,7 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@ -94,6 +96,11 @@ public class CoreBuildTab extends AbstractLaunchConfigurationTab {
return LaunchMessages.CoreBuildTab_Build;
}
@Override
public Image getImage() {
return LaunchImages.get(LaunchImages.IMG_VIEW_CORE_BUILD_TAB);
}
private IProject getProject(ILaunchConfiguration configuration) {
try {
for (IResource resource : configuration.getMappedResources()) {

View file

@ -7,16 +7,13 @@
<unit id="org.eclipse.cdt.gnu.dsf.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.gdb.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.debug.standalone.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.core.lrparser.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.visualizer.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.core.lrparser.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.xlc.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.remote.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.docker.launcher.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.gnu.debug.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.platform.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.debug.ui.memory.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.testsrunner.source.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.bupc.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.debug.ui.memory.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.core.parser.upc.feature.feature.group" version="0.0.0"/>
@ -34,7 +31,6 @@
<unit id="org.eclipse.cdt.xlc.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.debug.standalone.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.core.parser.upc.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.managedbuilder.llvm.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
<unit id="org.eclipse.cdt.gnu.build.feature.group" version="0.0.0"/>
@ -50,13 +46,15 @@
<unit id="org.eclipse.cdt.autotools.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.tools.templates.core" version="0.0.0"/>
<unit id="org.eclipse.tools.templates.ui" version="0.0.0"/>
<repository location="http://download.eclipse.org/tools/cdt/builds/neon/milestones/ur2-rc4"/>
<repository location="http://download.eclipse.org/tools/cdt/releases/9.3/cdt9.3.0/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/releases/neon"/>
<unit id="org.eclipse.launchbar.feature.group" version="0.0.0"/>
<unit id="org.eclipse.launchbar.remote.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/tools/cdt/launchbar/oxygen/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/tools/cdt/launchbar/neon.2"/>
<repository location="http://download.eclipse.org/releases/oxygen/201706281000/"/>
</location>
</locations>
</target>