Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2012-01-21 13:09:20 -0500
committerDoug Schaefer2012-01-21 13:12:12 -0500
commit873e3587aeb14a8c73f5dd2f0b6ab0d7635a9823 (patch)
tree2bf815330aae37133d2e1eca873af45a4da42b1b
parent3b3f194391396d440a0d28685f58db9ed13fd30c (diff)
downloadorg.eclipse.cdt-873e3587aeb14a8c73f5dd2f0b6ab0d7635a9823.tar.gz
org.eclipse.cdt-873e3587aeb14a8c73f5dd2f0b6ab0d7635a9823.tar.xz
org.eclipse.cdt-873e3587aeb14a8c73f5dd2f0b6ab0d7635a9823.zip
Start of new new CDT project wizard.
-rw-r--r--core/org.eclipse.cdt.ui/plugin.properties3
-rw-r--r--core/org.eclipse.cdt.ui/plugin.xml11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/Messages.java31
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java84
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java55
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/messages.properties17
6 files changed, 201 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index a0361934ba..b1c9591dfa 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -628,3 +628,6 @@ transfer.EditorBehavior.description = Preference related to how the editor proce
RefreshExclusionContributor.name = Resources
extension-point.name = Refresh Exclusion Contributor
+
+# New New Project Wizard
+newProjectWizard.name = C/C++ Project (new)
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 8713787520..213506932b 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -454,6 +454,17 @@
%Cproject.desc
</description>
</wizard>
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.cdt.ui.newCWizards"
+ class="org.eclipse.cdt.ui.wizards.NewCDTProjectWizard"
+ finalPerspective="org.eclipse.cdt.ui.CPerspective"
+ hasPages="true"
+ icon="icons/elcl16/newmngc_app.gif"
+ id="org.eclipse.cdt.ui.wizards.newProject"
+ name="%newProjectWizard.name"
+ project="true">
+ </wizard>
</extension>
<!-- Define the document setup participant for the C/C++ and Assembly Editors -->
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
new file mode 100644
index 0000000000..37a94c7a97
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/Messages.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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
new file mode 100644
index 0000000000..eb0336db32
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewCDTProjectWizard.java
@@ -0,0 +1,84 @@
+package org.eclipse.cdt.ui.wizards;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
+
+/**
+ * This is the new CDT project wizard.
+ *
+ * Without subclassing, it is in it's most generic form.
+ *
+ * Subclasses can filter or select the languages and add template filters.
+ *
+ * @author Doug Schaefer
+ * @since 5.4
+ */
+public class NewCDTProjectWizard extends Wizard implements INewWizard {
+
+ private IStructuredSelection selection;
+ private WizardNewProjectCreationPage mainPage;
+ private TemplateSelectionPage templatePage;
+ private WizardNewProjectReferencePage referencePage;
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ setNeedsProgressMonitor(true);
+ setWindowTitle(Messages.NewCDTProjectWizard_windowTitle);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ createWorkingSetGroup(
+ (Composite) getControl(),
+ selection,
+ new String[] { "org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$
+ "org.eclipse.cdt.ui.CElementWorkingSetPage" }); //$NON-NLS-1$
+ Dialog.applyDialogFont(getControl());
+ }
+ };
+ mainPage.setTitle(Messages.NewCDTProjectWizard_mainPageTitle);
+ mainPage.setDescription(Messages.NewCDTProjectWizard_mainPageDesc);
+ addPage(mainPage);
+
+ templatePage = new TemplateSelectionPage();
+ templatePage.setTitle(Messages.NewCDTProjectWizard_templatePageTitle);
+ templatePage.setDescription(Messages.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
+ .setDescription(Messages.NewCDTProjectWizard_refPageDesc);
+ this.addPage(referencePage);
+ }
+ }
+
+ @Override
+ public boolean canFinish() {
+ // TODO make sure we have everything in place first.
+ return false;
+ }
+
+}
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
new file mode 100644
index 0000000000..7ca68f7589
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/TemplateSelectionPage.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.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.Composite;
+import org.eclipse.swt.widgets.List;
+
+import org.eclipse.cdt.ui.templateengine.Template;
+import org.eclipse.cdt.ui.templateengine.TemplateEngineUI;
+
+/**
+ * @author Dad
+ * @since 5.4
+ */
+public class TemplateSelectionPage extends WizardPage {
+
+ public TemplateSelectionPage() {
+ super("templateSelection"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(1, false));
+
+ List templateList = new List(comp, SWT.BORDER);
+ templateList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Template[] templates = TemplateEngineUI.getDefault().getTemplates();
+ for (Template template : templates) {
+ templateList.add(template.getLabel());
+ }
+
+ setControl(comp);
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return true;
+ }
+
+}
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
new file mode 100644
index 0000000000..e44a79ce2d
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/messages.properties
@@ -0,0 +1,17 @@
+#################################################################################
+# 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

Back to the top