mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Start of new new CDT project wizard.
This commit is contained in:
parent
3b3f194391
commit
873e3587ae
6 changed files with 201 additions and 0 deletions
|
@ -628,3 +628,6 @@ transfer.EditorBehavior.description = Preference related to how the editor proce
|
||||||
RefreshExclusionContributor.name = Resources
|
RefreshExclusionContributor.name = Resources
|
||||||
|
|
||||||
extension-point.name = Refresh Exclusion Contributor
|
extension-point.name = Refresh Exclusion Contributor
|
||||||
|
|
||||||
|
# New New Project Wizard
|
||||||
|
newProjectWizard.name = C/C++ Project (new)
|
||||||
|
|
|
@ -454,6 +454,17 @@
|
||||||
%Cproject.desc
|
%Cproject.desc
|
||||||
</description>
|
</description>
|
||||||
</wizard>
|
</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>
|
</extension>
|
||||||
|
|
||||||
<!-- Define the document setup participant for the C/C++ and Assembly Editors -->
|
<!-- Define the document setup participant for the C/C++ and Assembly Editors -->
|
||||||
|
|
|
@ -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() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
Loading…
Add table
Reference in a new issue