mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 180256 - Launch configurations should support build variables
This commit is contained in:
parent
f1a62f0fe3
commit
4a793c0801
18 changed files with 156 additions and 96 deletions
|
@ -27,7 +27,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
|||
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
|
||||
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
||||
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||
org.eclipse.core.variables;bundle-version="3.2.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.ibm.icu.text
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2012 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
|
||||
|
@ -52,6 +52,7 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.IStatusHandler;
|
||||
|
@ -542,7 +543,11 @@ public class CDebugUtils {
|
|||
* @since 6.0
|
||||
*/
|
||||
public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
|
||||
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2010 Freescale and others.
|
||||
* Copyright (c) 2008, 2012 Freescale 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
|
||||
|
@ -24,6 +24,7 @@ import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
|
|||
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -159,6 +160,7 @@ public class ProgramRelativePathSourceContainer extends AbstractSourceContainer{
|
|||
if (programName == null) {
|
||||
return fProgramPath; // return empty path
|
||||
}
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
|
||||
// get executable file
|
||||
IFile exeFile = null;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2012 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
|
||||
|
@ -33,6 +33,7 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -123,7 +124,11 @@ public class CDebugAdapter implements ICDIDebugger {
|
|||
}
|
||||
|
||||
public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
|
||||
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
String programName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String) null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
return programName;
|
||||
}
|
||||
|
||||
public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 Freescale Semiconductor and others.
|
||||
* Copyright (c) 2010, 2012 Freescale Semiconductor 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
|
||||
|
@ -32,6 +32,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -275,6 +276,7 @@ public class CSourceFinder implements ISourceFinder, ILaunchConfigurationListene
|
|||
String programNameConfig = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
|
||||
IProject project = resource.getProject();
|
||||
if (project != null && project.getName().equals(projectNameConfig)) {
|
||||
programNameConfig = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programNameConfig);
|
||||
Path path = new Path(programNameConfig);
|
||||
if (!path.isEmpty()) {
|
||||
IFile file = project.getFile(path);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2008, 2012 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
||||
|
@ -54,6 +55,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
|||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* IBM Corporation
|
||||
* Marc Khouzam (Ericsson) - Support setting the path in which the core file
|
||||
* dialog should start (Bug 362039)
|
||||
* Anton Gorenkov
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||
|
||||
|
@ -139,7 +140,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
protected void createExeFileGroup(Composite parent, int colSpan) {
|
||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout mainLayout = new GridLayout();
|
||||
mainLayout.numColumns = 3;
|
||||
mainLayout.marginHeight = 0;
|
||||
mainLayout.marginWidth = 0;
|
||||
mainComp.setLayout(mainLayout);
|
||||
|
@ -149,7 +149,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
fProgLabel = new Label(mainComp, SWT.NONE);
|
||||
fProgLabel.setText(LaunchMessages.getString("CMainTab.C/C++_Application")); //$NON-NLS-1$
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 3;
|
||||
fProgLabel.setLayoutData(gd);
|
||||
fProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
|
@ -161,7 +160,17 @@ public class CMainTab extends CAbstractMainTab {
|
|||
}
|
||||
});
|
||||
|
||||
fSearchButton = createPushButton(mainComp, LaunchMessages.getString("CMainTab.Search..."), null); //$NON-NLS-1$
|
||||
Composite buttonComp = new Composite(mainComp, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(3, false);
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
buttonComp.setLayout(layout);
|
||||
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||
buttonComp.setLayoutData(gd);
|
||||
buttonComp.setFont(parent.getFont());
|
||||
|
||||
createVariablesButton(buttonComp, LaunchMessages.getString("CMainTab.Variables"), fProgText); //$NON-NLS-1$
|
||||
fSearchButton = createPushButton(buttonComp, LaunchMessages.getString("CMainTab.Search..."), null); //$NON-NLS-1$
|
||||
fSearchButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -171,7 +180,7 @@ public class CMainTab extends CAbstractMainTab {
|
|||
});
|
||||
|
||||
Button browseForBinaryButton;
|
||||
browseForBinaryButton = createPushButton(mainComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
browseForBinaryButton = createPushButton(buttonComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
|
||||
browseForBinaryButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -444,6 +453,11 @@ public class CMainTab extends CAbstractMainTab {
|
|||
|
||||
if (!fDontCheckProgram) {
|
||||
String programName = fProgText.getText().trim();
|
||||
try {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
} catch (CoreException e) {
|
||||
// Silently ignore substitution failure (for consistency with "Arguments" and "Work directory" fields)
|
||||
}
|
||||
if (programName.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_not_specified")); //$NON-NLS-1$
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2008, 2010 QNX Software Systems and others.
|
||||
# Copyright (c) 2008, 2012 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
|
||||
|
@ -94,6 +94,7 @@ CMainTab.CoreFile_type=Core file
|
|||
CMainTab.TraceFile_type=Trace file
|
||||
CMainTab.CoreFile_path=Core file (leave blank or select root directory to trigger prompt):
|
||||
CMainTab.TraceFile_path=Trace data file (leave blank or select root directory to trigger prompt):
|
||||
CMainTab.Variables=&Variables...
|
||||
CMainTab.Search...=Searc&h Project...
|
||||
CMainTab.Choose_program_to_run=Choose a &program to run:
|
||||
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2011 Ericsson and others.
|
||||
* Copyright (c) 2010, 2012 Ericsson 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
|
||||
|
@ -105,7 +105,8 @@ public class LaunchUtils {
|
|||
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
|
||||
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
||||
}
|
||||
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
|
||||
IPath programPath = new Path(programName);
|
||||
if (programPath.isEmpty()) {
|
||||
abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), null, //$NON-NLS-1$
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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
|
||||
|
@ -60,6 +60,7 @@ import org.eclipse.core.runtime.Path;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -645,6 +646,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
|
|||
|
||||
if (configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_AUTO, false)) {
|
||||
String programPath = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STR);
|
||||
programPath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programPath);
|
||||
ICConfigurationDescription buildConfig = LaunchUtils.getBuildConfigByProgramPath(buildProject, programPath);
|
||||
if (buildConfig != null)
|
||||
buildConfigID = buildConfig.getId();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2011 Nokia and others.
|
||||
* Copyright (c) 2010, 2012 Nokia 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
|
||||
|
@ -43,6 +43,7 @@ import org.eclipse.core.runtime.MultiStatus;
|
|||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
@ -253,6 +254,7 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
|
|||
// If automatic configuration detection then discover the build config corresponding to the executable
|
||||
if (configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_AUTO, false)) {
|
||||
String programPath = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
|
||||
programPath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programPath);
|
||||
ICConfigurationDescription buildConfig = LaunchUtils.getBuildConfigByProgramPath(project, programPath);
|
||||
if (buildConfig != null)
|
||||
buildConfigID = buildConfig.getId();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2012 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
|
||||
|
@ -75,6 +75,7 @@ public class LaunchMessages extends NLS {
|
|||
public static String CMainTab_ProjectColon;
|
||||
public static String CMainTab_C_Application;
|
||||
public static String CMainTab_CoreFile_path;
|
||||
public static String CMainTab_Variables;
|
||||
public static String CMainTab_Search;
|
||||
public static String CMainTab_Choose_program_to_run;
|
||||
public static String CMainTab_Choose_program_to_run_from_NAME;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2002, 2010 QNX Software Systems and others.
|
||||
# Copyright (c) 2002, 2012 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:
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# Monta Vista - Joanne Woo - Bug 87556
|
||||
# Nokia - Ken Ryall - Bug 118894
|
||||
# Carlos O'Donnel (CodeSourcery) - Bug 218366
|
||||
# IBM Corporation
|
||||
# Sergey Prigogin (Google)
|
||||
# Nokia - Ken Ryall - Bug 118894
|
||||
# Carlos O'Donnel (CodeSourcery) - Bug 218366
|
||||
# IBM Corporation
|
||||
# Sergey Prigogin (Google)
|
||||
###############################################################################
|
||||
|
||||
AbstractCLaunchDelegate_Debugger_not_installed=CDT Debugger not installed
|
||||
|
@ -81,6 +81,7 @@ CMainTab_Main=Main
|
|||
CMainTab_ProjectColon=&Project:
|
||||
CMainTab_C_Application=C/C++ Application:
|
||||
CMainTab_CoreFile_path=Core file (leave blank to trigger prompt):
|
||||
CMainTab_Variables=&Variables...
|
||||
CMainTab_Search=Searc&h Project...
|
||||
CMainTab_Choose_program_to_run=Choose a &program to run:
|
||||
CMainTab_Choose_program_to_run_from_NAME=Choose a program to run from {0}:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2012 IBM Corporation 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:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.internal.ui;
|
||||
|
||||
|
@ -26,7 +26,6 @@ import org.eclipse.core.variables.IStringVariableManager;
|
|||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
|
@ -83,8 +82,6 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
handleWorkingDirBrowseButtonSelected();
|
||||
} else if (source == fUseDefaultWorkingDirButton) {
|
||||
handleUseDefaultWorkingDirButtonSelected();
|
||||
} else if (source == fVariablesButton) {
|
||||
handleWorkingDirVariablesButtonSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,8 +145,7 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
fFileSystemButton = createPushButton(buttonComp, LaunchMessages.WorkingDirectoryBlock_1, null);
|
||||
fFileSystemButton.addSelectionListener(fListener);
|
||||
|
||||
fVariablesButton = createPushButton(buttonComp, LaunchMessages.WorkingDirectoryBlock_17, null);
|
||||
fVariablesButton.addSelectionListener(fListener);
|
||||
fVariablesButton = createVariablesButton(buttonComp, LaunchMessages.WorkingDirectoryBlock_17, null);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -234,19 +230,6 @@ public class WorkingDirectoryBlock extends CLaunchConfigurationTab {
|
|||
fFileSystemButton.setEnabled(!def);
|
||||
}
|
||||
|
||||
protected void handleWorkingDirVariablesButtonSelected() {
|
||||
String variableText = getVariable();
|
||||
if (variableText != null) {
|
||||
fWorkingDirText.append(variableText);
|
||||
}
|
||||
}
|
||||
|
||||
private String getVariable() {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
dialog.open();
|
||||
return dialog.getVariableExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default working directory
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -20,15 +20,12 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -120,43 +117,12 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
|
|||
updateLaunchConfigurationDialog();
|
||||
}
|
||||
});
|
||||
fArgumentVariablesButton= createPushButton(group, LaunchMessages.CArgumentsTab_Variables, null);
|
||||
fArgumentVariablesButton= createVariablesButton(group, LaunchMessages.CArgumentsTab_Variables, fPrgmArgumentsText);
|
||||
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||
fArgumentVariablesButton.setLayoutData(gd);
|
||||
fArgumentVariablesButton.addSelectionListener(new SelectionAdapter() {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
handleVariablesButtonSelected(fPrgmArgumentsText);
|
||||
}
|
||||
});
|
||||
addControlAccessibleListener(fArgumentVariablesButton, fArgumentVariablesButton.getText()); // need to strip the mnemonic from buttons
|
||||
}
|
||||
|
||||
/**
|
||||
* A variable entry button has been pressed for the given text
|
||||
* field. Prompt the user for a variable and enter the result
|
||||
* in the given field.
|
||||
*/
|
||||
protected void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
textField.append(variable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user to choose and configure a variable and returns
|
||||
* the resulting string, suitable to be used as an attribute.
|
||||
*/
|
||||
private String getVariable() {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
dialog.open();
|
||||
return dialog.getVariableExpression();
|
||||
}
|
||||
|
||||
public void addControlAccessibleListener(Control control, String controlName) {
|
||||
//strip mnemonic (&)
|
||||
String[] strs = controlName.split("&"); //$NON-NLS-1$
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
* IBM Corporation
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
|
@ -375,6 +376,9 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (programName != null) {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - bug 178731
|
||||
* Anton Gorenkov
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -26,11 +27,18 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
||||
import org.eclipse.debug.ui.StringVariableSelectionDialog;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
|
@ -54,6 +62,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
|||
try {
|
||||
projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
|
||||
programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
|
||||
if (programName != null) {
|
||||
programName = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(programName);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
|
||||
|
@ -160,4 +171,44 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
|
|||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a button that allows user to insert build variables.
|
||||
*
|
||||
* @since 7.0
|
||||
*/
|
||||
protected Button createVariablesButton(Composite parent, String label, final Text textField) {
|
||||
Button variablesButton = createPushButton(parent, label, null);
|
||||
variablesButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
handleVariablesButtonSelected(textField);
|
||||
}
|
||||
});
|
||||
return variablesButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* A variable entry button has been pressed for the given text
|
||||
* field. Prompt the user for a variable and enter the result
|
||||
* in the given field.
|
||||
*/
|
||||
private void handleVariablesButtonSelected(Text textField) {
|
||||
String variable = getVariable();
|
||||
if (variable != null) {
|
||||
// We should use insert() but not append() to be consistent with the Platform behavior (e.g. Common tab)
|
||||
textField.insert(variable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user to choose and configure a variable and returns
|
||||
* the resulting string, suitable to be used as an attribute.
|
||||
*/
|
||||
private String getVariable() {
|
||||
StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
|
||||
dialog.open();
|
||||
return dialog.getVariableExpression();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2012 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
|
||||
|
@ -10,6 +10,7 @@
|
|||
* Ken Ryall (Nokia) - bug 178731
|
||||
* IBM Corporation
|
||||
* Sergey Prigogin (Google)
|
||||
* Anton Gorenkov
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -31,6 +32,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
|
@ -343,7 +345,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
protected void createExeFileGroup(Composite parent, int colSpan) {
|
||||
Composite mainComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout mainLayout = new GridLayout();
|
||||
mainLayout.numColumns = 3;
|
||||
mainLayout.marginHeight = 0;
|
||||
mainLayout.marginWidth = 0;
|
||||
mainComp.setLayout(mainLayout);
|
||||
|
@ -353,7 +354,6 @@ public class CMainTab extends CAbstractMainTab {
|
|||
fProgLabel = new Label(mainComp, SWT.NONE);
|
||||
fProgLabel.setText(LaunchMessages.CMainTab_C_Application);
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 3;
|
||||
fProgLabel.setLayoutData(gd);
|
||||
fProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
|
||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
|
@ -365,7 +365,17 @@ public class CMainTab extends CAbstractMainTab {
|
|||
}
|
||||
});
|
||||
|
||||
fSearchButton = createPushButton(mainComp, LaunchMessages.CMainTab_Search, null);
|
||||
Composite buttonComp = new Composite(mainComp, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(3, false);
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
buttonComp.setLayout(layout);
|
||||
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||
buttonComp.setLayoutData(gd);
|
||||
buttonComp.setFont(parent.getFont());
|
||||
|
||||
createVariablesButton(buttonComp, LaunchMessages.CMainTab_Variables, fProgText);
|
||||
fSearchButton = createPushButton(buttonComp, LaunchMessages.CMainTab_Search, null);
|
||||
fSearchButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -375,7 +385,7 @@ public class CMainTab extends CAbstractMainTab {
|
|||
});
|
||||
|
||||
Button fBrowseForBinaryButton;
|
||||
fBrowseForBinaryButton = createPushButton(mainComp, LaunchMessages.Launch_common_Browse_2, null);
|
||||
fBrowseForBinaryButton = createPushButton(buttonComp, LaunchMessages.Launch_common_Browse_2, null);
|
||||
fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent evt) {
|
||||
|
@ -432,6 +442,11 @@ public class CMainTab extends CAbstractMainTab {
|
|||
}
|
||||
|
||||
name = fProgText.getText().trim();
|
||||
try {
|
||||
name = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(name);
|
||||
} catch (CoreException e) {
|
||||
// Silently ignore substitution failure (for consistency with "Arguments" and "Work directory" fields)
|
||||
}
|
||||
if (name.length() == 0) {
|
||||
setErrorMessage(LaunchMessages.CMainTab_Program_not_specified);
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue