Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2012-02-08 17:03:38 -0500
committerDoug Schaefer2012-02-08 17:04:01 -0500
commite683d197ac8c35be9e86a5fa9976e2e2432d77a4 (patch)
tree913a71fbb1288bf9db5205c552b97a2221b20d3a /build/org.eclipse.cdt.managedbuilder.ui
parent1dbaf3c1baad7a1fd713b8b2c211f13d442eda7a (diff)
downloadorg.eclipse.cdt-e683d197ac8c35be9e86a5fa9976e2e2432d77a4.tar.gz
org.eclipse.cdt-e683d197ac8c35be9e86a5fa9976e2e2432d77a4.tar.xz
org.eclipse.cdt-e683d197ac8c35be9e86a5fa9976e2e2432d77a4.zip
Added ability to select toolchains for templates that have multiple.
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.ui')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/plugin.xml23
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java100
4 files changed, 127 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
index 94449d3aaf..9a6cb9b787 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
@@ -648,5 +648,28 @@
</description>
</wizard>
</extension>
+ <extension
+ point="org.eclipse.cdt.ui.projectTypePages">
+ <projectTypePage
+ class="org.eclipse.cdt.managedbuilder.ui.wizards.ToolChainSelectionPage"
+ id="org.eclipse.cdt.managedbuilder.ui.exeProjectTypePage"
+ projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
+ </projectTypePage>
+ <projectTypePage
+ class="org.eclipse.cdt.managedbuilder.ui.wizards.ToolChainSelectionPage"
+ id="org.eclipse.cdt.managedbuilder.ui.staticLibProjectTypePage"
+ projectType="org.eclipse.cdt.build.core.buildArtefactType.staticLib">
+ </projectTypePage>
+ <projectTypePage
+ class="org.eclipse.cdt.managedbuilder.ui.wizards.ToolChainSelectionPage"
+ id="org.eclipse.cdt.managedbuilder.ui.sharedLibProjectTypePage"
+ projectType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib">
+ </projectTypePage>
+ <projectTypePage
+ class="org.eclipse.cdt.managedbuilder.ui.wizards.ToolChainSelectionPage"
+ id="org.eclipse.cdt.managedbuilder.ui.makefileProjectTypePage"
+ projectType="org.eclipse.cdt.build.makefile.projectType">
+ </projectTypePage>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java
index 94f8c37d3f..9a53359c5c 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.java
@@ -279,6 +279,8 @@ public class Messages extends NLS {
public static String WizardDefaultsTab_0;
public static String WizardDefaultsTab_1;
public static String RefreshPolicyTab_resourcesTreeLabel;
+ public static String ToolChainSelectionPage_Description;
+ public static String ToolChainSelectionPage_Title;
static {
// Initialize resource bundle.
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties
index 3fdd4bfe8f..6501855af3 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/Messages.properties
@@ -300,3 +300,5 @@ NewCfgDialog_3=-- not selected --
NewCfgDialog_4=Import from projects
NewCfgDialog_5=Import predefined
+ToolChainSelectionPage_Description=Select the initial toolchain for this project.
+ToolChainSelectionPage_Title=Select Tool Chain
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java
new file mode 100644
index 0000000000..5c0079ff92
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ToolChainSelectionPage.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Doug Schaefer 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:
+ * Doug Schaefer - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.wizards;
+
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.cdt.ui.wizards.ProjectTypePage;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
+
+/**
+ * @since 8.1
+ *
+ */
+public class ToolChainSelectionPage extends WizardPage implements ProjectTypePage {
+
+ private IWizardPage nextPage;
+ private String[] toolChainIds;
+ private String selectedToolChainId;
+ private List toolChainList;
+
+ public ToolChainSelectionPage() {
+ super("ToolChainSelectionPage"); //$NON-NLS-1$
+ setTitle(Messages.ToolChainSelectionPage_Title);
+ setDescription(Messages.ToolChainSelectionPage_Description);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(1, true));
+
+ toolChainList = new List(comp, SWT.BORDER | SWT.SINGLE);
+ toolChainList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ for (String toolChainId : toolChainIds) {
+ IToolChain toolChain = ManagedBuildManager.getExtensionToolChain(toolChainId);
+ if (toolChain != null)
+ toolChainList.add(toolChain.getName());
+ }
+
+ toolChainList.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (toolChainList.getSelectionCount() == 0)
+ selectedToolChainId = null;
+ else
+ selectedToolChainId = toolChainIds[toolChainList.getSelectionIndex()];
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ setControl(comp);
+ }
+
+ @Override
+ public boolean init(Template template, IWizard wizard, IWizardPage nextPage) {
+ this.nextPage = nextPage;
+ setWizard(wizard);
+ toolChainIds = template.getTemplateInfo().getToolChainIds();
+
+ // only need this page if there are multiple toolChains to select from.
+ return toolChainIds != null && toolChainIds.length > 1;
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ if (nextPage != null)
+ return nextPage;
+ return super.getNextPage();
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return selectedToolChainId != null;
+ }
+
+}

Back to the top