mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Added ability to select toolchains for templates that have multiple.
This commit is contained in:
parent
1dbaf3c1ba
commit
e683d197ac
14 changed files with 355 additions and 60 deletions
|
@ -648,5 +648,28 @@
|
||||||
</description>
|
</description>
|
||||||
</wizard>
|
</wizard>
|
||||||
</extension>
|
</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>
|
</plugin>
|
||||||
|
|
|
@ -279,6 +279,8 @@ public class Messages extends NLS {
|
||||||
public static String WizardDefaultsTab_0;
|
public static String WizardDefaultsTab_0;
|
||||||
public static String WizardDefaultsTab_1;
|
public static String WizardDefaultsTab_1;
|
||||||
public static String RefreshPolicyTab_resourcesTreeLabel;
|
public static String RefreshPolicyTab_resourcesTreeLabel;
|
||||||
|
public static String ToolChainSelectionPage_Description;
|
||||||
|
public static String ToolChainSelectionPage_Title;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Initialize resource bundle.
|
// Initialize resource bundle.
|
||||||
|
|
|
@ -300,3 +300,5 @@ NewCfgDialog_3=-- not selected --
|
||||||
NewCfgDialog_4=Import from projects
|
NewCfgDialog_4=Import from projects
|
||||||
NewCfgDialog_5=Import predefined
|
NewCfgDialog_5=Import predefined
|
||||||
|
|
||||||
|
ToolChainSelectionPage_Description=Select the initial toolchain for this project.
|
||||||
|
ToolChainSelectionPage_Title=Select Tool Chain
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -631,3 +631,4 @@ extension-point.name = Refresh Exclusion Contributor
|
||||||
|
|
||||||
# New New Project Wizard
|
# New New Project Wizard
|
||||||
newProjectWizard.name = C/C++ Project (prototype)
|
newProjectWizard.name = C/C++ Project (prototype)
|
||||||
|
projectTypePages = Project Type Pages
|
|
@ -27,6 +27,7 @@
|
||||||
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
||||||
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
||||||
<extension-point id="RefreshExclusionContributor" name="%extension-point.name" schema="schema/RefreshExclusionContributor.exsd"/>
|
<extension-point id="RefreshExclusionContributor" name="%extension-point.name" schema="schema/RefreshExclusionContributor.exsd"/>
|
||||||
|
<extension-point id="projectTypePages" name="%ProjectTypePages" schema="schema/projectTypePages.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.core.runtime.adapters">
|
point="org.eclipse.core.runtime.adapters">
|
||||||
|
|
118
core/org.eclipse.cdt.ui/schema/projectTypePages.exsd
Normal file
118
core/org.eclipse.cdt.ui/schema/projectTypePages.exsd
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.cdt.ui" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.schema plugin="org.eclipse.cdt.ui" id="projectTypePages" name="%ProjectTypePages"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
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.
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.element />
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element ref="projectTypePage" minOccurs="1" maxOccurs="unbounded"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="projectTypePage">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="projectType" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="class" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.ui.wizards.ProjectTypePage"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter the first release in which this extension point appears.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter extension point usage example here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter API information here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
|
||||||
|
</schema>
|
|
@ -71,6 +71,13 @@ public final class CUIMessages extends NLS {
|
||||||
public static String FileTransferDragAdapter_refreshing;
|
public static String FileTransferDragAdapter_refreshing;
|
||||||
public static String FileTransferDragAdapter_problem;
|
public static String FileTransferDragAdapter_problem;
|
||||||
public static String FileTransferDragAdapter_problemTitle;
|
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 {
|
static {
|
||||||
NLS.initializeMessages(BUNDLE_NAME, CUIMessages.class);
|
NLS.initializeMessages(BUNDLE_NAME, CUIMessages.class);
|
||||||
|
|
|
@ -73,3 +73,11 @@ CStructureCreatorVisitor_translationUnitName=Translation Unit
|
||||||
FileTransferDragAdapter_refreshing=Refreshing...
|
FileTransferDragAdapter_refreshing=Refreshing...
|
||||||
FileTransferDragAdapter_problem=Problem while moving or copying files.
|
FileTransferDragAdapter_problem=Problem while moving or copying files.
|
||||||
FileTransferDragAdapter_problemTitle=Drag & Drop
|
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
|
||||||
|
|
|
@ -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() {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,6 +11,8 @@ import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
|
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
|
||||||
import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
|
import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CUIMessages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the new CDT project wizard.
|
* 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) {
|
public void init(IWorkbench workbench, IStructuredSelection selection) {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
setNeedsProgressMonitor(true);
|
setNeedsProgressMonitor(true);
|
||||||
setWindowTitle(Messages.NewCDTProjectWizard_windowTitle);
|
setWindowTitle(CUIMessages.NewCDTProjectWizard_windowTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,22 +58,22 @@ public class NewCDTProjectWizard extends Wizard implements INewWizard {
|
||||||
Dialog.applyDialogFont(getControl());
|
Dialog.applyDialogFont(getControl());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mainPage.setTitle(Messages.NewCDTProjectWizard_mainPageTitle);
|
mainPage.setTitle(CUIMessages.NewCDTProjectWizard_mainPageTitle);
|
||||||
mainPage.setDescription(Messages.NewCDTProjectWizard_mainPageDesc);
|
mainPage.setDescription(CUIMessages.NewCDTProjectWizard_mainPageDesc);
|
||||||
addPage(mainPage);
|
addPage(mainPage);
|
||||||
|
|
||||||
templatePage = new TemplateSelectionPage();
|
templatePage = new TemplateSelectionPage();
|
||||||
templatePage.setTitle(Messages.NewCDTProjectWizard_templatePageTitle);
|
templatePage.setTitle(CUIMessages.NewCDTProjectWizard_templatePageTitle);
|
||||||
templatePage.setDescription(Messages.NewCDTProjectWizard_templatePageDesc);
|
templatePage.setDescription(CUIMessages.NewCDTProjectWizard_templatePageDesc);
|
||||||
addPage(templatePage);
|
addPage(templatePage);
|
||||||
|
|
||||||
// only add page if there are already projects in the workspace
|
// only add page if there are already projects in the workspace
|
||||||
if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) {
|
if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) {
|
||||||
referencePage = new WizardNewProjectReferencePage(
|
referencePage = new WizardNewProjectReferencePage(
|
||||||
"basicReferenceProjectPage");//$NON-NLS-1$
|
"basicReferenceProjectPage");//$NON-NLS-1$
|
||||||
referencePage.setTitle(Messages.NewCDTProjectWizard_refPageTitle);
|
referencePage.setTitle(CUIMessages.NewCDTProjectWizard_refPageTitle);
|
||||||
referencePage
|
referencePage
|
||||||
.setDescription(Messages.NewCDTProjectWizard_refPageDesc);
|
.setDescription(CUIMessages.NewCDTProjectWizard_refPageDesc);
|
||||||
this.addPage(referencePage);
|
this.addPage(referencePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
|
@ -14,7 +14,13 @@ package org.eclipse.cdt.ui.wizards;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
|
@ -90,7 +96,7 @@ public class TemplateSelectionPage extends WizardPage {
|
||||||
|
|
||||||
private TreeViewer templateTree;
|
private TreeViewer templateTree;
|
||||||
private Template selectedTemplate;
|
private Template selectedTemplate;
|
||||||
private IWizardPage[] nextPages;
|
private IWizardPage nextPage;
|
||||||
|
|
||||||
public TemplateSelectionPage() {
|
public TemplateSelectionPage() {
|
||||||
super("templateSelection"); //$NON-NLS-1$
|
super("templateSelection"); //$NON-NLS-1$
|
||||||
|
@ -179,7 +185,7 @@ public class TemplateSelectionPage extends WizardPage {
|
||||||
@Override
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
selectedTemplate = null;
|
selectedTemplate = null;
|
||||||
nextPages = null;
|
nextPage = null;
|
||||||
IStructuredSelection selection = (IStructuredSelection)templateTree.getSelection();
|
IStructuredSelection selection = (IStructuredSelection)templateTree.getSelection();
|
||||||
Object selObj = selection.getFirstElement();
|
Object selObj = selection.getFirstElement();
|
||||||
if (selObj instanceof Node) {
|
if (selObj instanceof Node) {
|
||||||
|
@ -187,8 +193,19 @@ public class TemplateSelectionPage extends WizardPage {
|
||||||
if (object instanceof Template) {
|
if (object instanceof Template) {
|
||||||
IWizard wizard = getWizard();
|
IWizard wizard = getWizard();
|
||||||
selectedTemplate = (Template)object;
|
selectedTemplate = (Template)object;
|
||||||
nextPages = selectedTemplate.getTemplateWizardPages(TemplateSelectionPage.this,
|
|
||||||
|
// Get the template pages
|
||||||
|
IWizardPage[] templatePages = selectedTemplate.getTemplateWizardPages(TemplateSelectionPage.this,
|
||||||
wizard.getNextPage(TemplateSelectionPage.this), wizard);
|
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);
|
setPageComplete(true);
|
||||||
} else {
|
} else {
|
||||||
setPageComplete(false);
|
setPageComplete(false);
|
||||||
|
@ -215,8 +232,8 @@ public class TemplateSelectionPage extends WizardPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWizardPage getNextPage() {
|
public IWizardPage getNextPage() {
|
||||||
if (nextPages != null && nextPages.length > 0)
|
if (nextPage != null)
|
||||||
return nextPages[0];
|
return nextPage;
|
||||||
return super.getNextPage();
|
return super.getNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,4 +305,33 @@ public class TemplateSelectionPage extends WizardPage {
|
||||||
return nodes;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
Loading…
Add table
Reference in a new issue