Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Gorenkov2012-04-02 17:47:17 +0000
committerSergey Prigogin2012-04-02 17:47:17 +0000
commit4a793c08017316b0959946aca2b9c682032479f0 (patch)
treeac917aacf8f411a6bfb93056ea68dbf3e37ec2c5 /launch/org.eclipse.cdt.launch
parentf1a62f0fe3948a2a2f3b45cb315d67fbb0104442 (diff)
downloadorg.eclipse.cdt-4a793c08017316b0959946aca2b9c682032479f0.tar.gz
org.eclipse.cdt-4a793c08017316b0959946aca2b9c682032479f0.tar.xz
org.eclipse.cdt-4a793c08017316b0959946aca2b9c682032479f0.zip
Bug 180256 - Launch configurations should support build variables
Diffstat (limited to 'launch/org.eclipse.cdt.launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java4
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java4
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java3
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties13
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java23
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java42
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java12
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java57
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java25
9 files changed, 104 insertions, 79 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
index 5df21eb9b06..ca52c713c25 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
@@ -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();
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java
index ba922b69a58..d9f4615b490 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java
@@ -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();
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
index cc9e0b974e3..1652d80a8a7 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
@@ -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;
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
index c11f42f7238..a6efff76eea 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
@@ -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}:
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java
index 0c7072e042c..cd51893b3b8 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java
@@ -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
*/
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java
index 9d54a8a9213..e34034b837c 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java
@@ -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$
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
index 62390e06418..c10fdf98598 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
@@ -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) {
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
index 8e255761c94..27280d70d51 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
@@ -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();
+ }
+
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index 14df978f8fc..24c5a96682a 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -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;

Back to the top