Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-10-12 19:38:26 +0000
committerDoug Schaefer2017-10-12 20:03:58 +0000
commitaffb599f2490deeba0451367d51bdefe50b1f8e4 (patch)
tree6ad3fd1614351fcf4c16343866942a4b67b6ae59 /build/org.eclipse.cdt.cmake.ui
parentf2115d3a561529bc13b59c68c0b0d8eec13d48da (diff)
downloadorg.eclipse.cdt-affb599f2490deeba0451367d51bdefe50b1f8e4.tar.gz
org.eclipse.cdt-affb599f2490deeba0451367d51bdefe50b1f8e4.tar.xz
org.eclipse.cdt-affb599f2490deeba0451367d51bdefe50b1f8e4.zip
Allow for changing manually setting toolchains for build configs.
A number of changes that clean up how build configs are done. Now build settings are stored with the build config instead of in launch configs. That makes it less launch bar specific. Add build settings UI to change the toolchain used for a given launch config. Also changed CMake so it's IToolchain based instead of property which doesn't work when multiple IToolchains match. Change-Id: I958d90ede3c1f873ab1530c2b2880808e8f7abef
Diffstat (limited to 'build/org.eclipse.cdt.cmake.ui')
-rw-r--r--build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF3
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java6
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java167
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java43
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java17
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java79
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java8
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties16
8 files changed, 208 insertions, 131 deletions
diff --git a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
index 78e0949d57f..0f54e0028b4 100644
--- a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.ui;bundle-version="3.11.200",
org.eclipse.cdt.launch;bundle-version="9.1.0",
org.eclipse.cdt.debug.core;bundle-version="8.1.0",
- org.eclipse.cdt.ui;bundle-version="6.2.0"
+ org.eclipse.cdt.ui;bundle-version="6.2.0",
+ org.eclipse.launchbar.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
index d0e3630ac5e..036da68941b 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
@@ -40,9 +40,13 @@ public class Activator extends AbstractUIPlugin {
return new Status(IStatus.ERROR, PLUGIN_ID, message, cause);
}
+ public static void log(IStatus status) {
+ plugin.getLog().log(status);
+ }
+
public static void log(Exception e) {
if (e instanceof CoreException) {
- plugin.getLog().log(((CoreException) e).getStatus());
+ log(((CoreException) e).getStatus());
} else {
plugin.getLog().log(errorStatus(e.getLocalizedMessage(), e));
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
index 6cc9a02e012..9ce46b0fa28 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java
@@ -7,15 +7,14 @@
*******************************************************************************/
package org.eclipse.cdt.cmake.ui.internal;
-import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
-import org.eclipse.cdt.debug.core.launch.CoreBuildLaunchConfigDelegate;
-import org.eclipse.core.runtime.CoreException;
+import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfigurationProvider;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.launch.ui.corebuild.CommonBuildTab;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -23,10 +22,12 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
+public class CMakeBuildTab extends CommonBuildTab {
private Button unixGenButton;
private Button ninjaGenButton;
@@ -35,15 +36,28 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
private Text cleanCommandText;
@Override
+ protected String getBuildConfigProviderId() {
+ return CMakeBuildConfigurationProvider.ID;
+ }
+
+ @Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
setControl(comp);
- Label label = new Label(comp, SWT.NONE);
+ Control tcControl = createToolchainSelector(comp);
+ tcControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Group cmakeGroup = new Group(comp, SWT.NONE);
+ cmakeGroup.setText(Messages.CMakeBuildTab_Settings);
+ cmakeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ cmakeGroup.setLayout(new GridLayout());
+
+ Label label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_Generator);
- Composite genComp = new Composite(comp, SWT.BORDER);
+ Composite genComp = new Composite(cmakeGroup, SWT.BORDER);
genComp.setLayout(new GridLayout(2, true));
unixGenButton = new Button(genComp, SWT.RADIO);
@@ -64,67 +78,61 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
}
});
- label = new Label(comp, SWT.NONE);
+ label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_CMakeArgs);
- cmakeArgsText = new Text(comp, SWT.BORDER);
+ cmakeArgsText = new Text(cmakeGroup, SWT.BORDER);
cmakeArgsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
cmakeArgsText.addModifyListener(e -> updateLaunchConfigurationDialog());
- label = new Label(comp, SWT.NONE);
+ label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_BuildCommand);
- buildCommandText = new Text(comp, SWT.BORDER);
+ buildCommandText = new Text(cmakeGroup, SWT.BORDER);
buildCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
buildCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
- label = new Label(comp, SWT.NONE);
+ label = new Label(cmakeGroup, SWT.NONE);
label.setText(Messages.CMakeBuildTab_CleanCommand);
- cleanCommandText = new Text(comp, SWT.BORDER);
+ cleanCommandText = new Text(cmakeGroup, SWT.BORDER);
cleanCommandText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
cleanCommandText.addModifyListener(e -> updateLaunchConfigurationDialog());
}
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- String mode = getLaunchConfigurationDialog().getMode();
- configuration.removeAttribute("COREBUILD_" + mode); //$NON-NLS-1$
+ // TODO
}
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
- try {
- String mode = getLaunchConfigurationDialog().getMode();
- // TODO find a home for the attribute name
- Map<String, String> properties = configuration.getAttribute("COREBUILD_" + mode, //$NON-NLS-1$
- new HashMap<>());
-
- String generator = properties.get(CMakeBuildConfiguration.CMAKE_GENERATOR);
- updateGeneratorButtons(generator);
-
- String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
- if (cmakeArgs != null) {
- cmakeArgsText.setText(cmakeArgs);
- } else {
- cmakeArgsText.setText(""); //$NON-NLS-1$
- }
+ super.initializeFrom(configuration);
- String buildCommand = properties.get(CMakeBuildConfiguration.BUILD_COMMAND);
- if (buildCommand != null) {
- buildCommandText.setText(buildCommand);
- } else {
- buildCommandText.setText(""); //$NON-NLS-1$
- }
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
- String cleanCommand = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
- if (cleanCommand != null) {
- cleanCommandText.setText(buildCommand);
- } else {
- cleanCommandText.setText(""); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- Activator.log(e);
+ String generator = buildConfig.getProperty(CMakeBuildConfiguration.CMAKE_GENERATOR);
+ updateGeneratorButtons(generator);
+
+ String cmakeArgs = buildConfig.getProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
+ if (cmakeArgs != null) {
+ cmakeArgsText.setText(cmakeArgs);
+ } else {
+ cmakeArgsText.setText(""); //$NON-NLS-1$
+ }
+
+ String buildCommand = buildConfig.getProperty(CMakeBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null) {
+ buildCommandText.setText(buildCommand);
+ } else {
+ buildCommandText.setText(""); //$NON-NLS-1$
+ }
+
+ String cleanCommand = buildConfig.getProperty(CMakeBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null) {
+ cleanCommandText.setText(buildCommand);
+ } else {
+ cleanCommandText.setText(""); //$NON-NLS-1$
}
}
@@ -138,32 +146,83 @@ public class CMakeBuildTab extends AbstractLaunchConfigurationTab {
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- Map<String, String> properties = new HashMap<>();
+ super.performApply(configuration);
- properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR,
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+
+ buildConfig.setProperty(CMakeBuildConfiguration.CMAKE_GENERATOR,
ninjaGenButton.getSelection() ? "Ninja" : "Unix Makefiles"); //$NON-NLS-1$ //$NON-NLS-2$
String cmakeArgs = cmakeArgsText.getText().trim();
if (!cmakeArgs.isEmpty()) {
- properties.put(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgs);
+ buildConfig.setProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgs);
+ } else {
+ buildConfig.removeProperty(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
}
String buildCommand = buildCommandText.getText().trim();
if (!buildCommand.isEmpty()) {
- properties.put(CMakeBuildConfiguration.BUILD_COMMAND, buildCommand);
+ buildConfig.setProperty(CMakeBuildConfiguration.BUILD_COMMAND, buildCommand);
+ } else {
+ buildConfig.removeProperty(CMakeBuildConfiguration.BUILD_COMMAND);
}
String cleanCommand = cleanCommandText.getText().trim();
if (!cleanCommand.isEmpty()) {
- properties.put(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ buildConfig.setProperty(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ } else {
+ buildConfig.removeProperty(CMakeBuildConfiguration.CLEAN_COMMAND);
+ }
+ }
+
+ @Override
+ protected void saveProperties(Map<String, String> properties) {
+ super.saveProperties(properties);
+ properties.put(CMakeBuildConfiguration.CMAKE_GENERATOR,
+ ninjaGenButton.getSelection() ? "Ninja" : "Unix Makefiles"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ properties.put(CMakeBuildConfiguration.CMAKE_ARGUMENTS, cmakeArgsText.getText().trim());
+ properties.put(CMakeBuildConfiguration.BUILD_COMMAND, buildCommandText.getText().trim());
+ properties.put(CMakeBuildConfiguration.CLEAN_COMMAND, cleanCommandText.getText().trim());
+ }
+
+ @Override
+ protected void restoreProperties(Map<String, String> properties) {
+ super.restoreProperties(properties);
+
+ String gen = properties.get(CMakeBuildConfiguration.CMAKE_GENERATOR);
+ if (gen != null) {
+ switch (gen) {
+ case "Ninja": //$NON-NLS-1$
+ ninjaGenButton.setSelection(true);
+ unixGenButton.setSelection(false);
+ break;
+ case "Unix Makefiles": //$NON-NLS-1$
+ ninjaGenButton.setSelection(false);
+ unixGenButton.setSelection(true);
+ break;
+ }
+ }
+
+ String cmakeArgs = properties.get(CMakeBuildConfiguration.CMAKE_ARGUMENTS);
+ if (cmakeArgs != null) {
+ cmakeArgsText.setText(cmakeArgs);
+ } else {
+ cmakeArgsText.setText(""); //$NON-NLS-1$
+ }
+
+ String buildCmd = properties.get(CMakeBuildConfiguration.BUILD_COMMAND);
+ if (buildCmd != null) {
+ buildCommandText.setText(buildCmd);
+ } else {
+ buildCommandText.setText(""); //$NON-NLS-1$
}
- String buildAttribute = CoreBuildLaunchConfigDelegate
- .getBuildAttributeName(getLaunchConfigurationDialog().getMode());
- if (!properties.isEmpty()) {
- configuration.setAttribute(buildAttribute, properties);
+ String cleanCmd = properties.get(CMakeBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCmd != null) {
+ cleanCommandText.setText(cleanCmd);
} else {
- configuration.removeAttribute(buildAttribute);
+ cleanCommandText.setText(""); //$NON-NLS-1$
}
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
index 94406b75ac5..7cc58fbb996 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakePreferencePage.java
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.preference.PreferencePage;
@@ -59,7 +60,7 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
Group filesGroup = new Group(control, SWT.NONE);
filesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- filesGroup.setText("ToolChain Files");
+ filesGroup.setText(Messages.CMakePreferencePage_Files);
filesGroup.setLayout(new GridLayout(2, false));
Composite filesComp = new Composite(filesGroup, SWT.NONE);
@@ -75,18 +76,14 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
});
TableColumn pathColumn = new TableColumn(filesTable, SWT.NONE);
- pathColumn.setText("ToolChain File");
+ pathColumn.setText(Messages.CMakePreferencePage_Path);
- TableColumn osColumn = new TableColumn(filesTable, SWT.NONE);
- osColumn.setText("OS");
-
- TableColumn archColumn = new TableColumn(filesTable, SWT.NONE);
- archColumn.setText("CPU");
+ TableColumn tcColumn = new TableColumn(filesTable, SWT.NONE);
+ tcColumn.setText(Messages.CMakePreferencePage_Toolchain);
TableColumnLayout tableLayout = new TableColumnLayout();
- tableLayout.setColumnData(pathColumn, new ColumnWeightData(75, 350, true));
- tableLayout.setColumnData(osColumn, new ColumnWeightData(25, 100, true));
- tableLayout.setColumnData(archColumn, new ColumnWeightData(25, 100, true));
+ tableLayout.setColumnData(pathColumn, new ColumnWeightData(50, 350, true));
+ tableLayout.setColumnData(tcColumn, new ColumnWeightData(50, 350, true));
filesComp.setLayout(tableLayout);
Composite buttonsComp = new Composite(filesGroup, SWT.NONE);
@@ -95,11 +92,11 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
Button addButton = new Button(buttonsComp, SWT.PUSH);
addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- addButton.setText("Add...");
+ addButton.setText(Messages.CMakePreferencePage_Add);
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- NewCMakeToolChainFileWizard wizard = new NewCMakeToolChainFileWizard(getFiles());
+ NewCMakeToolChainFileWizard wizard = new NewCMakeToolChainFileWizard();
WizardDialog dialog = new WizardDialog(getShell(), wizard);
if (dialog.open() == Window.OK) {
ICMakeToolChainFile file = wizard.getNewFile();
@@ -115,11 +112,11 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
removeButton = new Button(buttonsComp, SWT.PUSH);
removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- removeButton.setText("Remove");
+ removeButton.setText(Messages.CMakePreferencePage_Remove);
removeButton.setEnabled(false);
removeButton.addListener(SWT.Selection, e -> {
- if (MessageDialog.openConfirm(getShell(), "Deregister CMake ToolChain File",
- "Do you wish to deregister the selected files?")) {
+ if (MessageDialog.openConfirm(getShell(), Messages.CMakePreferencePage_ConfirmRemoveTitle,
+ Messages.CMakePreferencePage_ConfirmRemoveDesc)) {
for (TableItem item : filesTable.getSelection()) {
ICMakeToolChainFile file = (ICMakeToolChainFile) item.getData();
if (filesToAdd.containsKey(file.getPath())) {
@@ -145,14 +142,16 @@ public class CMakePreferencePage extends PreferencePage implements IWorkbenchPre
for (ICMakeToolChainFile file : sorted) {
TableItem item = new TableItem(filesTable, SWT.NONE);
item.setText(0, file.getPath().toString());
- String os = file.getProperty(IToolChain.ATTR_OS);
- if (os != null) {
- item.setText(1, os);
- }
- String arch = file.getProperty(IToolChain.ATTR_ARCH);
- if (arch != null) {
- item.setText(2, arch);
+
+ try {
+ IToolChain tc = file.getToolChain();
+ if (tc != null) {
+ item.setText(1, tc.getName());
+ }
+ } catch (CoreException e) {
+ Activator.log(e.getStatus());
}
+
item.setData(file);
}
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java
index 50df2366fab..91e4a323295 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java
@@ -17,7 +17,17 @@ public class Messages extends NLS {
public static String CMakeBuildTab_CMakeArgs;
public static String CMakeBuildTab_Generator;
public static String CMakeBuildTab_Ninja;
+ public static String CMakeBuildTab_NoneAvailable;
+ public static String CMakeBuildTab_Settings;
+ public static String CMakeBuildTab_Toolchain;
public static String CMakeBuildTab_UnixMakefiles;
+ public static String CMakePreferencePage_Add;
+ public static String CMakePreferencePage_ConfirmRemoveDesc;
+ public static String CMakePreferencePage_ConfirmRemoveTitle;
+ public static String CMakePreferencePage_Files;
+ public static String CMakePreferencePage_Path;
+ public static String CMakePreferencePage_Remove;
+ public static String CMakePreferencePage_Toolchain;
public static String CMakePropertyPage_FailedToStartCMakeGui_Body;
public static String CMakePropertyPage_FailedToStartCMakeGui_Title;
public static String CMakePropertyPage_LaunchCMakeGui;
@@ -26,6 +36,13 @@ public class Messages extends NLS {
public static String NewCMakeProjectWizard_PageTitle;
public static String NewCMakeProjectWizard_WindowTitle;
+ public static String NewCMakeToolChainFilePage_Browse;
+ public static String NewCMakeToolChainFilePage_NoPath;
+ public static String NewCMakeToolChainFilePage_Path;
+ public static String NewCMakeToolChainFilePage_Select;
+ public static String NewCMakeToolChainFilePage_Title;
+ public static String NewCMakeToolChainFilePage_Toolchain;
+
static {
// initialize resource bundle
NLS.initializeMessages("org.eclipse.cdt.cmake.ui.internal.messages", Messages.class); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java
index b40c60a2d86..4e6f63b9cae 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFilePage.java
@@ -7,18 +7,20 @@
*******************************************************************************/
package org.eclipse.cdt.cmake.ui.internal;
-import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Map;
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.cdt.cmake.core.ICMakeToolChainManager;
+import org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration;
import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
@@ -26,14 +28,13 @@ import org.eclipse.swt.widgets.Text;
public class NewCMakeToolChainFilePage extends WizardPage {
- private final Map<Path, ICMakeToolChainFile> existing;
private Text pathText;
- private Text osText;
- private Text archText;
+ private Combo tcCombo;
- public NewCMakeToolChainFilePage(Map<Path, ICMakeToolChainFile> existing) {
- super("NewCMakeToolChainFilePage", "New CMake ToolChain File", null); //$NON-NLS-1$
- this.existing = existing;
+ private IToolChain[] toolchains;
+
+ public NewCMakeToolChainFilePage() {
+ super("NewCMakeToolChainFilePage", Messages.NewCMakeToolChainFilePage_Title, null); //$NON-NLS-1$
}
@Override
@@ -44,7 +45,7 @@ public class NewCMakeToolChainFilePage extends WizardPage {
Label pathLabel = new Label(comp, SWT.NONE);
pathLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- pathLabel.setText("Path:");
+ pathLabel.setText(Messages.NewCMakeToolChainFilePage_Path);
Composite pathComp = new Composite(comp, SWT.NONE);
pathComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
@@ -58,31 +59,33 @@ public class NewCMakeToolChainFilePage extends WizardPage {
Button pathButton = new Button(pathComp, SWT.PUSH);
pathButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- pathButton.setText("Browse...");
+ pathButton.setText(Messages.NewCMakeToolChainFilePage_Browse);
pathButton.addListener(SWT.Selection, e -> {
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
- dialog.setText("Select location for CMake toolchain file");
+ dialog.setText(Messages.NewCMakeToolChainFilePage_Select);
String path = dialog.open();
if (path != null) {
pathText.setText(path);
}
});
- Label osLabel = new Label(comp, SWT.NONE);
- osLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- osLabel.setText("Target OS:");
-
- osText = new Text(comp, SWT.BORDER);
- osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- osText.addModifyListener(e -> validate());
-
- Label archLabel = new Label(comp, SWT.NONE);
- archLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- archLabel.setText("Target CPU:");
-
- archText = new Text(comp, SWT.BORDER);
- archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- archText.addModifyListener(e -> validate());
+ Label tcLabel = new Label(comp, SWT.NONE);
+ tcLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ tcLabel.setText(Messages.NewCMakeToolChainFilePage_Toolchain);
+
+ tcCombo = new Combo(comp, SWT.READ_ONLY);
+ tcCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ try {
+ IToolChainManager tcManager = Activator.getService(IToolChainManager.class);
+ toolchains = tcManager.getAllToolChains().toArray(new IToolChain[0]);
+ for (IToolChain tc : toolchains) {
+ tcCombo.add(tc.getName());
+ }
+ tcCombo.select(0);
+ } catch (CoreException e) {
+ Activator.log(e.getStatus());
+ }
setControl(comp);
validate();
@@ -93,17 +96,7 @@ public class NewCMakeToolChainFilePage extends WizardPage {
String path = pathText.getText();
if (path.isEmpty()) {
- setErrorMessage("Please set the path to the CMake toolchain file.");
- return;
- }
-
- if (existing.containsKey(Paths.get(path))) {
- setErrorMessage("CMake toolchain file entry already exists.");
- return;
- }
-
- if (osText.getText().isEmpty()) {
- setErrorMessage("Please set the target operating system.");
+ setErrorMessage(Messages.NewCMakeToolChainFilePage_NoPath);
return;
}
@@ -115,15 +108,9 @@ public class NewCMakeToolChainFilePage extends WizardPage {
ICMakeToolChainManager manager = Activator.getService(ICMakeToolChainManager.class);
ICMakeToolChainFile file = manager.newToolChainFile(Paths.get(pathText.getText()));
- String os = osText.getText();
- if (!os.isEmpty()) {
- file.setProperty(IToolChain.ATTR_OS, os);
- }
-
- String arch = archText.getText();
- if (!arch.isEmpty()) {
- file.setProperty(IToolChain.ATTR_ARCH, arch);
- }
+ IToolChain tc = toolchains[tcCombo.getSelectionIndex()];
+ file.setProperty(CMakeBuildConfiguration.TOOLCHAIN_TYPE, tc.getProvider().getId());
+ file.setProperty(CMakeBuildConfiguration.TOOLCHAIN_ID, tc.getId());
return file;
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java
index f5be2f3e642..fe616eeeac9 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeToolChainFileWizard.java
@@ -7,9 +7,6 @@
*******************************************************************************/
package org.eclipse.cdt.cmake.ui.internal;
-import java.nio.file.Path;
-import java.util.Map;
-
import org.eclipse.cdt.cmake.core.ICMakeToolChainFile;
import org.eclipse.jface.wizard.Wizard;
@@ -18,12 +15,9 @@ public class NewCMakeToolChainFileWizard extends Wizard {
private ICMakeToolChainFile newFile;
private NewCMakeToolChainFilePage page;
- public NewCMakeToolChainFileWizard(Map<Path, ICMakeToolChainFile> existing) {
- page = new NewCMakeToolChainFilePage(existing);
- }
-
@Override
public void addPages() {
+ page = new NewCMakeToolChainFilePage();
addPage(page);
}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
index 51b607823f3..09d2055d8c4 100644
--- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
@@ -4,10 +4,26 @@ CMakeBuildTab_Cmake=CMake
CMakeBuildTab_CMakeArgs=Additional CMake arguments:
CMakeBuildTab_Generator=Generator
CMakeBuildTab_Ninja=Ninja
+CMakeBuildTab_NoneAvailable=No Toolchains Available for this Target
+CMakeBuildTab_Settings=CMake Settings
+CMakeBuildTab_Toolchain=Toolchain
CMakeBuildTab_UnixMakefiles=Unix Makefiles
+CMakePreferencePage_Add=Add...
+CMakePreferencePage_ConfirmRemoveDesc=Do you wish to deregister the selected files?
+CMakePreferencePage_ConfirmRemoveTitle=Deregister CMake ToolChain File
+CMakePreferencePage_Files=Toolchain Files
+CMakePreferencePage_Path=Toolchain File
+CMakePreferencePage_Remove=Remove
+CMakePreferencePage_Toolchain=Toolchain
CMakePropertyPage_FailedToStartCMakeGui_Body=Failed to run the CMake GUI:
CMakePropertyPage_FailedToStartCMakeGui_Title=Failed to run CMake GUI
CMakePropertyPage_LaunchCMakeGui=Launch CMake GUI...
NewCMakeProjectWizard_Description=Specify properties of new CMake project.
NewCMakeProjectWizard_PageTitle=New CMake Project
NewCMakeProjectWizard_WindowTitle=New CMake Project
+NewCMakeToolChainFilePage_Browse=Browse...
+NewCMakeToolChainFilePage_NoPath=Please set the path to the CMake toolchain file.
+NewCMakeToolChainFilePage_Path=Path:
+NewCMakeToolChainFilePage_Select=Select location for CMake toolchain file
+NewCMakeToolChainFilePage_Title=New CMake ToolChain File
+NewCMakeToolChainFilePage_Toolchain=Toolchain:

Back to the top