diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
index 94449d3aaf7..9a6cb9b7870 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
@@ -648,5 +648,28 @@
+
+
+
+
+
+
+
+
+
+
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 94f8c37d3f6..9a53359c5c2 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 3fdd4bfe8fb..6501855af3d 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 00000000000..5c0079ff92c
--- /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;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index 87d10a5f7ee..f50ea9bbbe8 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -631,3 +631,4 @@ extension-point.name = Refresh Exclusion Contributor
# New New Project Wizard
newProjectWizard.name = C/C++ Project (prototype)
+projectTypePages = Project Type Pages
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 213506932b9..a04963c4b9d 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -27,6 +27,7 @@
+
diff --git a/core/org.eclipse.cdt.ui/schema/projectTypePages.exsd b/core/org.eclipse.cdt.ui/schema/projectTypePages.exsd
new file mode 100644
index 00000000000..c3268a79163
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/schema/projectTypePages.exsd
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+ This extension is used to register a page in the CDT new project wizard to support
+specifying additional information based on the project type associated with a template.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [Enter the first release in which this extension point appears.]
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java
index c6a0008048c..c50e1e9744d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.java
@@ -71,6 +71,13 @@ public final class CUIMessages extends NLS {
public static String FileTransferDragAdapter_refreshing;
public static String FileTransferDragAdapter_problem;
public static String FileTransferDragAdapter_problemTitle;
+ public static String NewCDTProjectWizard_mainPageDesc;
+ public static String NewCDTProjectWizard_mainPageTitle;
+ public static String NewCDTProjectWizard_refPageDesc;
+ public static String NewCDTProjectWizard_refPageTitle;
+ public static String NewCDTProjectWizard_templatePageDesc;
+ public static String NewCDTProjectWizard_templatePageTitle;
+ public static String NewCDTProjectWizard_windowTitle;
static {
NLS.initializeMessages(BUNDLE_NAME, CUIMessages.class);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties
index 581ad5ed2d5..f200d3d2a42 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties
@@ -73,3 +73,11 @@ CStructureCreatorVisitor_translationUnitName=Translation Unit
FileTransferDragAdapter_refreshing=Refreshing...
FileTransferDragAdapter_problem=Problem while moving or copying files.
FileTransferDragAdapter_problemTitle=Drag & Drop
+
+NewCDTProjectWizard_mainPageDesc=Create a new C/C++ Project
+NewCDTProjectWizard_mainPageTitle=Project
+NewCDTProjectWizard_refPageDesc=Select referenced projects
+NewCDTProjectWizard_refPageTitle=Project References
+NewCDTProjectWizard_templatePageDesc=Select a project template for the new project
+NewCDTProjectWizard_templatePageTitle=Project Template
+NewCDTProjectWizard_windowTitle=New C/C++ Project
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/Messages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/Messages.java
deleted file mode 100644
index 37a94c7a97a..00000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/Messages.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River 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:
- * Doug Schaefer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.wizards;
-
-import org.eclipse.osgi.util.NLS;
-
-class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.wizards.messages"; //$NON-NLS-1$
- public static String NewCDTProjectWizard_mainPageDesc;
- public static String NewCDTProjectWizard_mainPageTitle;
- public static String NewCDTProjectWizard_refPageDesc;
- public static String NewCDTProjectWizard_refPageTitle;
- public static String NewCDTProjectWizard_templatePageDesc;
- public static String NewCDTProjectWizard_templatePageTitle;
- public static String NewCDTProjectWizard_windowTitle;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java
index 282d6e93b5c..df418029cc3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java
@@ -11,6 +11,8 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
+import org.eclipse.cdt.internal.ui.CUIMessages;
+
/**
* This is the new CDT project wizard.
*
@@ -32,7 +34,7 @@ public class NewCDTProjectWizard extends Wizard implements INewWizard {
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
setNeedsProgressMonitor(true);
- setWindowTitle(Messages.NewCDTProjectWizard_windowTitle);
+ setWindowTitle(CUIMessages.NewCDTProjectWizard_windowTitle);
}
@Override
@@ -56,22 +58,22 @@ public class NewCDTProjectWizard extends Wizard implements INewWizard {
Dialog.applyDialogFont(getControl());
}
};
- mainPage.setTitle(Messages.NewCDTProjectWizard_mainPageTitle);
- mainPage.setDescription(Messages.NewCDTProjectWizard_mainPageDesc);
+ mainPage.setTitle(CUIMessages.NewCDTProjectWizard_mainPageTitle);
+ mainPage.setDescription(CUIMessages.NewCDTProjectWizard_mainPageDesc);
addPage(mainPage);
templatePage = new TemplateSelectionPage();
- templatePage.setTitle(Messages.NewCDTProjectWizard_templatePageTitle);
- templatePage.setDescription(Messages.NewCDTProjectWizard_templatePageDesc);
+ templatePage.setTitle(CUIMessages.NewCDTProjectWizard_templatePageTitle);
+ templatePage.setDescription(CUIMessages.NewCDTProjectWizard_templatePageDesc);
addPage(templatePage);
// only add page if there are already projects in the workspace
if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) {
referencePage = new WizardNewProjectReferencePage(
"basicReferenceProjectPage");//$NON-NLS-1$
- referencePage.setTitle(Messages.NewCDTProjectWizard_refPageTitle);
+ referencePage.setTitle(CUIMessages.NewCDTProjectWizard_refPageTitle);
referencePage
- .setDescription(Messages.NewCDTProjectWizard_refPageDesc);
+ .setDescription(CUIMessages.NewCDTProjectWizard_refPageDesc);
this.addPage(referencePage);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java
new file mode 100644
index 00000000000..ad5eae3b08d
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/ProjectTypePage.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.ui.wizards;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+
+import org.eclipse.cdt.ui.templateengine.Template;
+
+/**
+ * @since 5.4
+ */
+public interface ProjectTypePage extends IWizardPage {
+
+ /**
+ * Init the page. Return false if the page isn't needed.
+ *
+ * @param template The selected template
+ * @param wizard The wizard object
+ * @param nextPage The next page after this one
+ * @return whether page is really needed
+ */
+ boolean init(Template template, IWizard wizard, IWizardPage nextPage);
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java
index 64920103516..2608bce5a5d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java
@@ -14,7 +14,13 @@ package org.eclipse.cdt.ui.wizards;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -90,7 +96,7 @@ public class TemplateSelectionPage extends WizardPage {
private TreeViewer templateTree;
private Template selectedTemplate;
- private IWizardPage[] nextPages;
+ private IWizardPage nextPage;
public TemplateSelectionPage() {
super("templateSelection"); //$NON-NLS-1$
@@ -179,7 +185,7 @@ public class TemplateSelectionPage extends WizardPage {
@Override
public void selectionChanged(SelectionChangedEvent event) {
selectedTemplate = null;
- nextPages = null;
+ nextPage = null;
IStructuredSelection selection = (IStructuredSelection)templateTree.getSelection();
Object selObj = selection.getFirstElement();
if (selObj instanceof Node) {
@@ -187,8 +193,19 @@ public class TemplateSelectionPage extends WizardPage {
if (object instanceof Template) {
IWizard wizard = getWizard();
selectedTemplate = (Template)object;
- nextPages = selectedTemplate.getTemplateWizardPages(TemplateSelectionPage.this,
+
+ // Get the template pages
+ IWizardPage[] templatePages = selectedTemplate.getTemplateWizardPages(TemplateSelectionPage.this,
wizard.getNextPage(TemplateSelectionPage.this), wizard);
+ if (templatePages != null && templatePages.length > 0)
+ nextPage = templatePages[0];
+
+ String projectType = selectedTemplate.getTemplateInfo().getProjectType();
+ ProjectTypePage projectTypePage = getProjectTypePage(projectType);
+ if (projectTypePage != null) {
+ if (projectTypePage.init(selectedTemplate, wizard, nextPage))
+ nextPage = projectTypePage;
+ }
setPageComplete(true);
} else {
setPageComplete(false);
@@ -215,8 +232,8 @@ public class TemplateSelectionPage extends WizardPage {
@Override
public IWizardPage getNextPage() {
- if (nextPages != null && nextPages.length > 0)
- return nextPages[0];
+ if (nextPage != null)
+ return nextPage;
return super.getNextPage();
}
@@ -288,4 +305,33 @@ public class TemplateSelectionPage extends WizardPage {
return nodes;
}
+ private ProjectTypePage getProjectTypePage(String projectType) {
+ if (projectType != null && !projectType.isEmpty()) {
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint point = reg.getExtensionPoint(CUIPlugin.PLUGIN_ID, "projectTypePages"); //$NON-NLS-1$
+ if (point == null)
+ return null;
+ IExtension[] exts = point.getExtensions();
+ for (IExtension ext : exts) {
+ IConfigurationElement[] elems = ext.getConfigurationElements();
+ for (IConfigurationElement elem : elems) {
+ if (elem.getName().equals("projectTypePage")) { //$NON-NLS-1$
+ String ept = elem.getAttribute("projectType"); //$NON-NLS-1$
+ if (projectType.equals(ept)) {
+ try {
+ Object obj = elem.createExecutableExtension("class"); //$NON-NLS-1$
+ if (obj instanceof ProjectTypePage)
+ return (ProjectTypePage)obj;
+ } catch (CoreException e) {
+ CUIPlugin.log(e.getStatus());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/messages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/messages.properties
deleted file mode 100644
index e44a79ce2d9..00000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/messages.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-#################################################################################
-# Copyright (c) 2012 Wind River 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:
-# Doug Schaefer - initial API and implementation
-#################################################################################
-NewCDTProjectWizard_mainPageDesc=Create a new C/C++ Project
-NewCDTProjectWizard_mainPageTitle=Project
-NewCDTProjectWizard_refPageDesc=Select referenced projects
-NewCDTProjectWizard_refPageTitle=Project References
-NewCDTProjectWizard_templatePageDesc=Select a project template for the new project
-NewCDTProjectWizard_templatePageTitle=Project Template
-NewCDTProjectWizard_windowTitle=New C/C++ Project