mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug #160012: rework of New Project Wizard
This commit is contained in:
parent
c321859b30
commit
d3abc551c9
36 changed files with 714 additions and 802 deletions
|
@ -1,128 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2005 Innoopract Informationssysteme GmbH 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:
|
|
||||||
* Innoopract - Initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.managedbuilder.ui.tests;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.tests.util.TestProjectType;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.CDTProjectWizard;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.CMainWizardPage;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.CWizardHandler;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.IToolChainListListener;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.NewModelProjectWizard;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.ui.PlatformUI;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests for the get/setSelectedProjectType() of CProjectPlatformPage.
|
|
||||||
* @author Elias Volanakis
|
|
||||||
*/
|
|
||||||
public class TestCProjectPlatformPage extends TestCase implements IToolChainListListener {
|
|
||||||
|
|
||||||
//TODO: migrate to the new UI functionality
|
|
||||||
private CDTProjectWizard wizard;
|
|
||||||
private TestPage page;
|
|
||||||
private boolean currentState=false;
|
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
|
||||||
MBSCustomPageManager.init();
|
|
||||||
MBSCustomPageManager.loadExtensions();
|
|
||||||
wizard = new CDTProjectWizard();
|
|
||||||
page = new TestPage(wizard);
|
|
||||||
wizard.addPages();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void tearDown() throws Exception {
|
|
||||||
page.dispose();
|
|
||||||
page = null;
|
|
||||||
wizard = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// testing methods
|
|
||||||
//////////////////
|
|
||||||
|
|
||||||
/* Test the new page, set selection, create page lifecycle. */
|
|
||||||
public void testHandler1() throws Exception {
|
|
||||||
IProjectType pt = new TestProjectType();
|
|
||||||
CWizardHandler h = new CWizardHandler("name", pt, null, null, this);
|
|
||||||
assertEquals(0, h.getToolChainsCount());
|
|
||||||
/*
|
|
||||||
IToolchain tc = new Toolchain(new TestFolderInfo());
|
|
||||||
IToolChain xz;
|
|
||||||
tc.setId("test1");
|
|
||||||
h.addTc(tc);
|
|
||||||
// Test toolchain cannot be added
|
|
||||||
assertEquals(h.getToolChainsCount(), 1);
|
|
||||||
tc = new TestToolchain();
|
|
||||||
h.addTc(tc);
|
|
||||||
assertEquals(h.getToolChainsCount(), 2);
|
|
||||||
IToolChain[] tcs = h.getSelectedToolChains();
|
|
||||||
assertEquals(tcs.length, 33);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Test the new page, create page, set selection lifecycle. */
|
|
||||||
public void testProject() throws Exception {
|
|
||||||
|
|
||||||
IPath p = ResourcesPlugin.getWorkspace().getRoot().getLocation();
|
|
||||||
/*
|
|
||||||
NewModelProjectWizard wiz = new CDTProjectWizard();
|
|
||||||
/*
|
|
||||||
String s = System.getenv("TEMP");
|
|
||||||
|
|
||||||
System.out.println(s);
|
|
||||||
assertNotNull(wiz);
|
|
||||||
/*
|
|
||||||
IProject pr1 = wiz.createIProject("test1", null);
|
|
||||||
assertNotNull(pr1);
|
|
||||||
|
|
||||||
IProject pr2 = wiz.createIProject("test2", p.append("test2"));
|
|
||||||
assertNotNull(pr2);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tests that setting the selection to a projectType thats not on the list,
|
|
||||||
* is handled correctly.
|
|
||||||
*/
|
|
||||||
public void testSelectedProjectType3() throws Exception {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// helping methods and classes
|
|
||||||
//////////////////////////////
|
|
||||||
|
|
||||||
private Shell getShell() {
|
|
||||||
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
|
||||||
}
|
|
||||||
|
|
||||||
class TestPage extends CMainWizardPage {
|
|
||||||
TestPage(CDTProjectWizard wizard) throws Exception {
|
|
||||||
super(CMainWizardPage.class.getName(), null);
|
|
||||||
}
|
|
||||||
IProjectType getFirstType() {
|
|
||||||
return null; //(IProjectType) projectTypes.get(0);
|
|
||||||
}
|
|
||||||
IProjectType getSecondType() {
|
|
||||||
return null; //(IProjectType) projectTypes.get(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// methods of IToolChainListListener
|
|
||||||
public boolean isCurrent() { return currentState; }
|
|
||||||
public void toolChainListChanged(int count) {}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 835 B |
Binary file not shown.
Before Width: | Height: | Size: 111 B |
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
<extension-point id="newWizardPages" name="Custom MBS New Wizard Pages" schema="schema/newWizardPages.exsd"/>
|
<extension-point id="newWizardPages" name="Custom MBS New Wizard Pages" schema="schema/newWizardPages.exsd"/>
|
||||||
<extension-point id="DiscoveryProfileUI" name="DiscoveryProfileUI" schema="schema/DiscoveryProfileUI.exsd"/>
|
<extension-point id="DiscoveryProfileUI" name="DiscoveryProfileUI" schema="schema/DiscoveryProfileUI.exsd"/>
|
||||||
<extension-point id="CDTWizard" name="CDTWizard" schema="schema/CDTWizard.exsd"/>
|
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.newWizards">
|
point="org.eclipse.ui.newWizards">
|
||||||
|
@ -413,7 +412,7 @@
|
||||||
<extension
|
<extension
|
||||||
id="BuildSystemWizard"
|
id="BuildSystemWizard"
|
||||||
name="%Build.System.Wizard"
|
name="%Build.System.Wizard"
|
||||||
point="org.eclipse.cdt.managedbuilder.ui.CDTWizard">
|
point="org.eclipse.cdt.ui.CDTWizard">
|
||||||
<wizard
|
<wizard
|
||||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.CNewWizard"
|
class="org.eclipse.cdt.managedbuilder.ui.wizards.CNewWizard"
|
||||||
name="%Build.System.Wizard">
|
name="%Build.System.Wizard">
|
||||||
|
|
|
@ -1,122 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="org.eclipse.cdt.managedbuilder.ui">
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.schema plugin="org.eclipse.cdt.managedbuilder.ui" id="CDTWizard" name="CDTWizard"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter description of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="wizard" 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="wizard">
|
|
||||||
<complexType>
|
|
||||||
<attribute name="class" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.ui.wizards.ICNewWizard"/>
|
|
||||||
</appInfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="parent" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.attribute kind="java"/>
|
|
||||||
</appInfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</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>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.section type="copyright"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
</schema>
|
|
|
@ -1,119 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="org.eclipse.cdt.managedbuilder.ui">
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.schema plugin="org.eclipse.cdt.managedbuilder.ui" id="CNewWizard" name="CNewWizard"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter description of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<complexType>
|
|
||||||
<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="wizard">
|
|
||||||
<complexType>
|
|
||||||
<attribute name="class" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.attribute kind="java"/>
|
|
||||||
</appInfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="parent" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.ui.newproperties.build.ICNewWizard"/>
|
|
||||||
</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>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appInfo>
|
|
||||||
<meta.section type="copyright"/>
|
|
||||||
</appInfo>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
</schema>
|
|
|
@ -14,10 +14,11 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
|
import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.PageLayout;
|
import org.eclipse.cdt.managedbuilder.ui.wizards.ICBuildWizardHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.CMainWizardPage;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.ICWizardHandler;
|
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
import org.eclipse.cdt.ui.newui.PageLayout;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
|
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -101,20 +102,22 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (h_selected != null)
|
if (h_selected != null)
|
||||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
switchTo(CMainWizardPage.updateData(tree, right, show_sup, null));
|
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null));
|
||||||
}} );
|
}} );
|
||||||
CDTPrefUtil.readPreferredTCs();
|
CDTPrefUtil.readPreferredTCs();
|
||||||
switchTo(CMainWizardPage.updateData(tree, right, show_sup, null));
|
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPref(boolean set) {
|
private void setPref(boolean set) {
|
||||||
if (h_selected == null || !h_selected.supportsPreferred())
|
if (h_selected == null || !h_selected.supportsPreferred())
|
||||||
return;
|
return;
|
||||||
IToolChain[] tcs = h_selected.getSelectedToolChains();
|
if (h_selected instanceof ICBuildWizardHandler) {
|
||||||
for (int i=0; i<tcs.length; i++) {
|
IToolChain[] tcs = ((ICBuildWizardHandler)h_selected).getSelectedToolChains();
|
||||||
String id = (tcs[i] == null) ? CDTPrefUtil.NULL : tcs[i].getId();
|
for (int i=0; i<tcs.length; i++) {
|
||||||
if (set) CDTPrefUtil.addPreferredTC(id);
|
String id = (tcs[i] == null) ? CDTPrefUtil.NULL : tcs[i].getId();
|
||||||
else CDTPrefUtil.delPreferredTC(id);
|
if (set) CDTPrefUtil.addPreferredTC(id);
|
||||||
|
else CDTPrefUtil.delPreferredTC(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
|
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,11 +81,6 @@ public class ManagedBuilderUIImages {
|
||||||
public static final String IMG_BUILT_IN = NAME_PREFIX + "built_in.gif"; //$NON-NLS-1$
|
public static final String IMG_BUILT_IN = NAME_PREFIX + "built_in.gif"; //$NON-NLS-1$
|
||||||
public static final ImageDescriptor DESC_BUILT_IN = createManaged(T_OBJ, IMG_BUILT_IN);
|
public static final ImageDescriptor DESC_BUILT_IN = createManaged(T_OBJ, IMG_BUILT_IN);
|
||||||
|
|
||||||
public static final String IMG_PREFERRED = NAME_PREFIX + "preferred.gif"; //$NON-NLS-1$
|
|
||||||
public static final ImageDescriptor DESC_PREFERRED = createManaged(T_OBJ, IMG_PREFERRED);
|
|
||||||
public static final String IMG_EMPTY = NAME_PREFIX + "empty.gif"; //$NON-NLS-1$
|
|
||||||
public static final ImageDescriptor DESC_EMPTY = createManaged(T_OBJ, IMG_EMPTY);
|
|
||||||
|
|
||||||
private static ImageDescriptor createManaged(String prefix, String name) {
|
private static ImageDescriptor createManaged(String prefix, String name) {
|
||||||
return createManaged(imageRegistry, prefix, name);
|
return createManaged(imageRegistry, prefix, name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
||||||
|
import org.eclipse.cdt.ui.newui.PageLayout;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.preference.IPreferencePageContainer;
|
import org.eclipse.jface.preference.IPreferencePageContainer;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
|
@ -76,29 +76,6 @@ PreferredToolchainsTab.2=Make toolhain(s) unpreferred
|
||||||
StdProjectTypeHandler.0=-- Other Toolchain --
|
StdProjectTypeHandler.0=-- Other Toolchain --
|
||||||
StdProjectTypeHandler.2=Default
|
StdProjectTypeHandler.2=Default
|
||||||
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||||
CConfigWizardPage.0=Select Configurations
|
|
||||||
CConfigWizardPage.1=Select platforms and configurations you wish to deploy on
|
|
||||||
CConfigWizardPage.4=Project type:
|
|
||||||
CConfigWizardPage.5=Tool-chains:
|
|
||||||
CConfigWizardPage.6=Configurations:
|
|
||||||
CConfigWizardPage.7=Select all
|
|
||||||
CConfigWizardPage.8=Deselect all
|
|
||||||
CConfigWizardPage.9=Edit properties after project creation
|
|
||||||
CConfigWizardPage.10=At least one configuration should be available. Project cannot be created.
|
|
||||||
CConfigWizardPage.11=At least one configuration should be selected. Please check needed configurations.
|
|
||||||
CConfigWizardPage.12=Use "Advanced settings" button to edit project's properties.\n\nAdditional configurations can be added after project creation.\nUse "Manage configurations" buttons either on toolbar or on property pages.
|
|
||||||
CConfigWizardPage.13=Advanced settings...
|
|
||||||
CMainWizardPage.0=Project types:
|
|
||||||
CMainWizardPage.1=Show project types and toolchains only if they are supported on the platform
|
|
||||||
CMainWizardPage.10=A project with that name already exists in the workspace.
|
|
||||||
CMainWizardPage.2=Edit properties after project creation
|
|
||||||
CMainWizardPage.3=No project types available. Project cannot be created
|
|
||||||
CMainWizardPage.4=At least one toolchain should be selected \!
|
|
||||||
CMainWizardPage.5=Cannot create ICProjectTypeHandler :
|
|
||||||
CMainWizardPage.6=File with specified name already exists \!
|
|
||||||
CMainWizardPage.7=Directory with specified name already exists \!
|
|
||||||
CMainWizardPage.8=Project name:
|
|
||||||
CMainWizardPage.9=Project name is empty
|
|
||||||
WizardNewProjectCreationPage_nameLabel=
|
WizardNewProjectCreationPage_nameLabel=
|
||||||
WizardNewProjectCreationPage_projectNameEmpty=
|
WizardNewProjectCreationPage_projectNameEmpty=
|
||||||
WizardNewProjectCreationPage_projectExistsMessage=
|
WizardNewProjectCreationPage_projectExistsMessage=
|
||||||
|
@ -117,14 +94,4 @@ NewModelProjectWizard.3=Create C++ project of selected type
|
||||||
NewModelProjectWizard.4=C project
|
NewModelProjectWizard.4=C project
|
||||||
NewModelProjectWizard.5=Create C project of selected type
|
NewModelProjectWizard.5=Create C project of selected type
|
||||||
StdBuildWizard.0=Makefile project
|
StdBuildWizard.0=Makefile project
|
||||||
ProjectContentsArea.0=Browse...
|
MBSWizardHandler.0=At least one toolchain should be selected
|
||||||
ProjectContentsArea.1=Use default location
|
|
||||||
ProjectContentsArea.2=Location:
|
|
||||||
ProjectContentsArea.3=Choose file system:
|
|
||||||
ProjectContentsArea.3=Invalid location path
|
|
||||||
ProjectContentsArea.4=Project contents directory must be specified
|
|
||||||
ProjectContentsArea.5=Select directory:
|
|
||||||
ProjectContentsArea.6=Project path should be absolute
|
|
||||||
ProjectContentsArea.7=Project path is not valid
|
|
||||||
ProjectContentsArea.8=Cannot create given path
|
|
||||||
ProjectContentsArea.9=File with given name already exists
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIImages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIImages;
|
||||||
|
import org.eclipse.cdt.ui.wizards.ICNewWizard;
|
||||||
|
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
||||||
import org.eclipse.cdt.utils.Platform;
|
import org.eclipse.cdt.utils.Platform;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -31,9 +33,9 @@ public abstract class AbstractCWizard implements ICNewWizard {
|
||||||
protected static final Image IMG2 = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_TOOL);
|
protected static final Image IMG2 = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_TOOL);
|
||||||
|
|
||||||
protected Composite parent;
|
protected Composite parent;
|
||||||
protected IToolChainListListener listener;
|
protected IWizardItemsListListener listener;
|
||||||
|
|
||||||
public void setDependentControl(Composite _parent, IToolChainListListener _listener) {
|
public void setDependentControl(Composite _parent, IWizardItemsListListener _listener) {
|
||||||
parent = _parent;
|
parent = _parent;
|
||||||
listener = _listener;
|
listener = _listener;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class CCProjectWizard extends NewModelProjectWizard {
|
public class CCProjectWizard extends MBSProjectWizard {
|
||||||
|
|
||||||
public CCProjectWizard() {
|
public CCProjectWizard() {
|
||||||
super(Messages.getString("NewModelProjectWizard.2"), Messages.getString("NewModelProjectWizard.3")); //$NON-NLS-1$ //$NON-NLS-2$
|
super(Messages.getString("NewModelProjectWizard.2"), Messages.getString("NewModelProjectWizard.3")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -11,13 +11,18 @@
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIImages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIImages;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
|
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
|
@ -26,6 +31,8 @@ import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -42,17 +49,16 @@ import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.TableItem;
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
import org.eclipse.ui.dialogs.PreferencesUtil;
|
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||||
|
|
||||||
public class CConfigWizardPage extends MBSCustomPage {
|
public class CDTConfigWizardPage extends WizardPage {
|
||||||
|
|
||||||
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.CConfigWizardPage"; //$NON-NLS-1$
|
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.CConfigWizardPage"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final Image IMG = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CONFIG);
|
private static final Image IMG = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CONFIG);
|
||||||
private static final String TITLE = Messages.getString("CConfigWizardPage.0"); //$NON-NLS-1$
|
private static final String TITLE = UIMessages.getString("CConfigWizardPage.0"); //$NON-NLS-1$
|
||||||
private static final String MESSAGE = Messages.getString("CConfigWizardPage.1"); //$NON-NLS-1$
|
private static final String MESSAGE = UIMessages.getString("CConfigWizardPage.1"); //$NON-NLS-1$
|
||||||
private static final String COMMENT = Messages.getString("CConfigWizardPage.12"); //$NON-NLS-1$
|
private static final String COMMENT = UIMessages.getString("CConfigWizardPage.12"); //$NON-NLS-1$
|
||||||
private static final String EMPTY_STR = ""; //$NON-NLS-1$
|
private static final String EMPTY_STR = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
private ICWizardHandler handler;
|
|
||||||
private Table table;
|
private Table table;
|
||||||
private CheckboxTableViewer tv;
|
private CheckboxTableViewer tv;
|
||||||
private Label l_projtype;
|
private Label l_projtype;
|
||||||
|
@ -62,12 +68,45 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
private String propertyId;
|
private String propertyId;
|
||||||
private String errorMessage = null;
|
private String errorMessage = null;
|
||||||
private String message = MESSAGE;
|
private String message = MESSAGE;
|
||||||
boolean isVisible = false;
|
public boolean isVisible = false;
|
||||||
|
private MBSWizardHandler handler;
|
||||||
|
public boolean pagesLoaded = false;
|
||||||
|
|
||||||
|
public CDTConfigWizardPage(MBSWizardHandler h) {
|
||||||
|
super(UIMessages.getString("CDTConfigWizardPage.0")); //$NON-NLS-1$
|
||||||
|
setPageComplete(false);
|
||||||
|
handler = h;
|
||||||
|
setWizard(h.getWizard());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCustomPages() {
|
||||||
|
if (pagesLoaded) return;
|
||||||
|
pagesLoaded = true;
|
||||||
|
|
||||||
|
if (! (getWizard() instanceof MBSProjectWizard)) return;
|
||||||
|
MBSProjectWizard wz = (MBSProjectWizard)getWizard();
|
||||||
|
|
||||||
|
IWizardPage p = MBSCustomPageManager.getPreviousPage(PAGE_ID);
|
||||||
|
MBSCustomPageManager.init();
|
||||||
|
MBSCustomPageManager.addStockPage(p, CDTMainWizardPage.PAGE_ID);
|
||||||
|
MBSCustomPageManager.addStockPage(this, CDTConfigWizardPage.PAGE_ID);
|
||||||
|
|
||||||
|
setCustomPagesFilter(wz);
|
||||||
|
// load all custom pages specified via extensions
|
||||||
|
try {
|
||||||
|
MBSCustomPageManager.loadExtensions();
|
||||||
|
} catch (BuildException e) { e.printStackTrace(); }
|
||||||
|
|
||||||
|
IWizardPage[] customPages = MBSCustomPageManager.getCustomPages();
|
||||||
|
if (customPages != null) {
|
||||||
|
for (int k = 0; k < customPages.length; k++) {
|
||||||
|
wz.addPage(customPages[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CConfigWizardPage() { pageID = PAGE_ID; }
|
|
||||||
|
|
||||||
public CfgHolder[] getCfgItems(boolean getDefault) {
|
public CfgHolder[] getCfgItems(boolean getDefault) {
|
||||||
if (handler == null) return null;
|
|
||||||
CfgHolder[] its;
|
CfgHolder[] its;
|
||||||
if (getDefault)
|
if (getDefault)
|
||||||
its = getDefaultCfgs(handler);
|
its = getDefaultCfgs(handler);
|
||||||
|
@ -88,11 +127,11 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
parent.setLayoutData(new GridData(GridData.FILL_BOTH));
|
parent.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
parent.setLayout(new GridLayout(3, false));
|
parent.setLayout(new GridLayout(3, false));
|
||||||
|
|
||||||
setupLabel(parent, Messages.getString("CConfigWizardPage.4"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
setupLabel(parent, UIMessages.getString("CConfigWizardPage.4"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||||
l_projtype = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
|
l_projtype = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
|
||||||
setupLabel(parent, Messages.getString("CConfigWizardPage.5"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
setupLabel(parent, UIMessages.getString("CConfigWizardPage.5"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||||
l_chains = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
|
l_chains = setupLabel(parent, EMPTY_STR, 2, GridData.FILL_HORIZONTAL);
|
||||||
setupLabel(parent, Messages.getString("CConfigWizardPage.6"), 3, GridData.BEGINNING); //$NON-NLS-1$
|
setupLabel(parent, UIMessages.getString("CConfigWizardPage.6"), 3, GridData.BEGINNING); //$NON-NLS-1$
|
||||||
|
|
||||||
table = new Table(parent, SWT.BORDER | SWT.CHECK);
|
table = new Table(parent, SWT.BORDER | SWT.CHECK);
|
||||||
GridData gd = new GridData(GridData.FILL_BOTH);
|
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||||
|
@ -109,13 +148,13 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
});
|
});
|
||||||
tv.setLabelProvider(new LabelProvider() {
|
tv.setLabelProvider(new LabelProvider() {
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
return element == null ? EMPTY_STR : ((CfgHolder)element).name;
|
return element == null ? EMPTY_STR : ((CfgHolder)element).getName();
|
||||||
}
|
}
|
||||||
public Image getImage(Object element) { return IMG; }
|
public Image getImage(Object element) { return IMG; }
|
||||||
});
|
});
|
||||||
tv.addCheckStateListener(new ICheckStateListener() {
|
tv.addCheckStateListener(new ICheckStateListener() {
|
||||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||||
isCustomPageComplete();
|
setPageComplete(isCustomPageComplete());
|
||||||
update();
|
update();
|
||||||
}});
|
}});
|
||||||
Composite c = new Composite(parent, SWT.NONE);
|
Composite c = new Composite(parent, SWT.NONE);
|
||||||
|
@ -123,22 +162,22 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
c.setLayout(new GridLayout(1, false));
|
c.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
Button b1 = new Button(c, SWT.PUSH);
|
Button b1 = new Button(c, SWT.PUSH);
|
||||||
b1.setText(Messages.getString("CConfigWizardPage.7")); //$NON-NLS-1$
|
b1.setText(UIMessages.getString("CConfigWizardPage.7")); //$NON-NLS-1$
|
||||||
b1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
b1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
b1.addSelectionListener(new SelectionAdapter() {
|
b1.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
tv.setAllChecked(true);
|
tv.setAllChecked(true);
|
||||||
isCustomPageComplete();
|
setPageComplete(isCustomPageComplete());
|
||||||
update();
|
update();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
Button b2 = new Button(c, SWT.PUSH);
|
Button b2 = new Button(c, SWT.PUSH);
|
||||||
b2.setText(Messages.getString("CConfigWizardPage.8")); //$NON-NLS-1$
|
b2.setText(UIMessages.getString("CConfigWizardPage.8")); //$NON-NLS-1$
|
||||||
b2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
b2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
b2.addSelectionListener(new SelectionAdapter() {
|
b2.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
tv.setAllChecked(false);
|
tv.setAllChecked(false);
|
||||||
isCustomPageComplete();
|
setPageComplete(isCustomPageComplete());
|
||||||
update();
|
update();
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
@ -146,7 +185,7 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
new Label(c, 0).setLayoutData(new GridData(GridData.FILL_BOTH));
|
new Label(c, 0).setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
|
||||||
Button b3 = new Button(c, SWT.PUSH);
|
Button b3 = new Button(c, SWT.PUSH);
|
||||||
b3.setText(Messages.getString("CConfigWizardPage.13")); //$NON-NLS-1$
|
b3.setText(UIMessages.getString("CConfigWizardPage.13")); //$NON-NLS-1$
|
||||||
b3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
b3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
b3.addSelectionListener(new SelectionAdapter() {
|
b3.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -167,7 +206,7 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
* @param handler
|
* @param handler
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static public CfgHolder[] getDefaultCfgs(ICWizardHandler handler) {
|
static public CfgHolder[] getDefaultCfgs(MBSWizardHandler handler) {
|
||||||
IToolChain[] tcs = handler.getSelectedToolChains();
|
IToolChain[] tcs = handler.getSelectedToolChains();
|
||||||
String id = handler.getPropertyId();
|
String id = handler.getPropertyId();
|
||||||
IProjectType pt = handler.getProjectType();
|
IProjectType pt = handler.getProjectType();
|
||||||
|
@ -203,12 +242,12 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
if (!isVisible) return true;
|
if (!isVisible) return true;
|
||||||
|
|
||||||
if (table.getItemCount() == 0) {
|
if (table.getItemCount() == 0) {
|
||||||
errorMessage = Messages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
|
errorMessage = UIMessages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
|
||||||
message = errorMessage;
|
message = errorMessage;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (tv.getCheckedElements().length == 0) {
|
if (tv.getCheckedElements().length == 0) {
|
||||||
errorMessage = Messages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
|
errorMessage = UIMessages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
|
||||||
message = errorMessage;
|
message = errorMessage;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -229,12 +268,13 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
IToolChain[] tc = handler.getSelectedToolChains();
|
IToolChain[] tc = handler.getSelectedToolChains();
|
||||||
for (int i=0; i < tc.length; i++) {
|
for (int i=0; i < tc.length; i++) {
|
||||||
s = s + ((tc[i] == null) ?
|
s = s + ((tc[i] == null) ?
|
||||||
Messages.getString("StdProjectTypeHandler.0") : //$NON-NLS-1$
|
"" : //$NON-NLS-1$
|
||||||
tc[i].getName());
|
tc[i].getName());
|
||||||
if (i < tc.length - 1) s = s + ", "; //$NON-NLS-1$
|
if (i < tc.length - 1) s = s + ", "; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
l_chains.setText(s);
|
l_chains.setText(s);
|
||||||
l_projtype.setText(handler.getName());
|
l_projtype.setText(handler.getName());
|
||||||
|
setPageComplete(isCustomPageComplete());
|
||||||
}
|
}
|
||||||
parent.setVisible(visible);
|
parent.setVisible(visible);
|
||||||
if (visible) update();
|
if (visible) update();
|
||||||
|
@ -252,14 +292,12 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHandler(ICWizardHandler h) { handler = h; }
|
|
||||||
|
|
||||||
public String getName() { return TITLE; }
|
public String getName() { return TITLE; }
|
||||||
public void dispose() {}
|
public void dispose() {}
|
||||||
public Control getControl() { return parent; }
|
public Control getControl() { return parent; }
|
||||||
public String getDescription() { return null; }
|
public String getDescription() { return null; }
|
||||||
public String getErrorMessage() { return errorMessage; }
|
public String getErrorMessage() { return errorMessage; }
|
||||||
public Image getImage() { return wizard.getDefaultPageImage(); }
|
// public Image getImage() { return wizard.getDefaultPageImage(); }
|
||||||
public String getMessage() { return message; }
|
public String getMessage() { return message; }
|
||||||
public String getTitle() { return TITLE; }
|
public String getTitle() { return TITLE; }
|
||||||
public void performHelp() {}
|
public void performHelp() {}
|
||||||
|
@ -268,24 +306,24 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
public void setTitle(String _title) {}
|
public void setTitle(String _title) {}
|
||||||
|
|
||||||
protected void update() {
|
protected void update() {
|
||||||
wizard.getContainer().updateButtons();
|
getWizard().getContainer().updateButtons();
|
||||||
wizard.getContainer().updateMessage();
|
getWizard().getContainer().updateMessage();
|
||||||
wizard.getContainer().updateTitleBar();
|
getWizard().getContainer().updateTitleBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit properties
|
* Edit properties
|
||||||
*/
|
*/
|
||||||
private void advancedDialog() {
|
private void advancedDialog() {
|
||||||
if (wizard instanceof NewModelProjectWizard) {
|
if (getWizard() instanceof MBSProjectWizard) {
|
||||||
NewModelProjectWizard nmWizard = (NewModelProjectWizard)wizard;
|
MBSProjectWizard nmWizard = (MBSProjectWizard)getWizard();
|
||||||
IProject newProject = nmWizard.getProject(true);
|
IProject newProject = nmWizard.getProject(true);
|
||||||
if (newProject != null) {
|
if (newProject != null) {
|
||||||
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG);
|
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG);
|
||||||
// disable manage configurations button
|
// disable manage configurations button
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, true);
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, true);
|
||||||
try {
|
try {
|
||||||
PreferencesUtil.createPropertyDialogOn(wizard.getContainer().getShell(), newProject, propertyId, null, null).open();
|
PreferencesUtil.createPropertyDialogOn(getWizard().getContainer().getShell(), newProject, propertyId, null, null).open();
|
||||||
} finally {
|
} finally {
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, oldManage);
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, oldManage);
|
||||||
}
|
}
|
||||||
|
@ -293,4 +331,34 @@ public class CConfigWizardPage extends MBSCustomPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IWizardPage getNextPage() {
|
||||||
|
addCustomPages();
|
||||||
|
return MBSCustomPageManager.getNextPage(PAGE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCustomPagesFilter(MBSProjectWizard wz) {
|
||||||
|
String[] natures = wz.getNatures();
|
||||||
|
if (natures == null || natures.length == 0)
|
||||||
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, null);
|
||||||
|
else if (natures.length == 1)
|
||||||
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, natures[0]);
|
||||||
|
else {
|
||||||
|
Set x = new TreeSet();
|
||||||
|
for (int i=0; i<natures.length; i++) x.add(natures[i]);
|
||||||
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, x);
|
||||||
|
}
|
||||||
|
if (handler.getProjectType() != null) {
|
||||||
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.PROJECT_TYPE, handler.getProjectType().getId());
|
||||||
|
} else {
|
||||||
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.PROJECT_TYPE, null);
|
||||||
|
}
|
||||||
|
IToolChain[] tcs = handler.getSelectedToolChains();
|
||||||
|
int n = (tcs == null) ? 0 : tcs.length;
|
||||||
|
Set x = new TreeSet();
|
||||||
|
for (int i=0; i<n; i++) {
|
||||||
|
x.add(tcs[i]);
|
||||||
|
}
|
||||||
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.TOOLCHAIN, x);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
public class CDTProjectWizard extends NewModelProjectWizard {
|
public class CDTProjectWizard extends MBSProjectWizard {
|
||||||
|
|
||||||
public CDTProjectWizard() {
|
public CDTProjectWizard() {
|
||||||
super(Messages.getString("NewModelProjectWizard.0"), Messages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
super(Messages.getString("NewModelProjectWizard.0"), Messages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
|
@ -22,40 +23,44 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
import org.eclipse.cdt.ui.wizards.WizardItemData;
|
||||||
import org.eclipse.swt.widgets.TreeItem;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CNewWizard extends AbstractCWizard {
|
public class CNewWizard extends AbstractCWizard {
|
||||||
/**
|
/**
|
||||||
* Creates and returns an array of
|
* Creates and returns an array of items to be displayed
|
||||||
*/
|
*/
|
||||||
public void createItems(Tree tree, boolean supportedOnly) {
|
public WizardItemData[] createItems(boolean supportedOnly, IWizard wizard) {
|
||||||
IBuildPropertyManager bpm = ManagedBuildManager.getBuildPropertyManager();
|
IBuildPropertyManager bpm = ManagedBuildManager.getBuildPropertyManager();
|
||||||
IBuildPropertyType bpt = bpm.getPropertyType(ICWizardHandler.ARTIFACT);
|
IBuildPropertyType bpt = bpm.getPropertyType(ICWizardHandler.ARTIFACT);
|
||||||
IBuildPropertyValue[] vs = bpt.getSupportedValues();
|
IBuildPropertyValue[] vs = bpt.getSupportedValues();
|
||||||
|
|
||||||
|
ArrayList items = new ArrayList();
|
||||||
// new style project types
|
// new style project types
|
||||||
for (int i=0; i<vs.length; i++) {
|
for (int i=0; i<vs.length; i++) {
|
||||||
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(ICWizardHandler.ARTIFACT, vs[i].getId());
|
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(ICWizardHandler.ARTIFACT, vs[i].getId());
|
||||||
if (tcs == null || tcs.length == 0) continue;
|
if (tcs == null || tcs.length == 0) continue;
|
||||||
CWizardHandler h = new CWizardHandler(vs[i], IMG1, parent, listener);
|
MBSWizardHandler h = new MBSWizardHandler(vs[i], IMG1, parent, listener, wizard);
|
||||||
for (int j=0; j<tcs.length; j++) {
|
for (int j=0; j<tcs.length; j++) {
|
||||||
if (!supportedOnly || isValid(tcs[j])) h.addTc(tcs[j]);
|
if (!supportedOnly || isValid(tcs[j])) h.addTc(tcs[j]);
|
||||||
}
|
}
|
||||||
if (h.getToolChainsCount() > 0) {
|
if (h.getToolChainsCount() > 0) {
|
||||||
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
WizardItemData wd = new WizardItemData();
|
||||||
ti.setText(h.getName());
|
wd.name = h.getName();
|
||||||
ti.setData(h);
|
wd.handler = h;
|
||||||
ti.setImage(h.getIcon());
|
wd.image = h.getIcon();
|
||||||
|
wd.id = h.getName();
|
||||||
|
wd.parentId = null;
|
||||||
|
items.add(wd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// old style project types
|
// old style project types
|
||||||
TreeItem oldsRoot = null;
|
WizardItemData oldsRoot = null;
|
||||||
SortedMap sm = ManagedBuildManager.getExtensionProjectTypeMap();
|
SortedMap sm = ManagedBuildManager.getExtensionProjectTypeMap();
|
||||||
Iterator it = sm.keySet().iterator();
|
Iterator it = sm.keySet().iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
|
@ -65,7 +70,7 @@ public class CNewWizard extends AbstractCWizard {
|
||||||
if (supportedOnly && !pt.isSupported()) continue; // not supported
|
if (supportedOnly && !pt.isSupported()) continue; // not supported
|
||||||
String nattr = pt.getNameAttribute();
|
String nattr = pt.getNameAttribute();
|
||||||
if (nattr == null || nattr.length() == 0) continue; // new proj style
|
if (nattr == null || nattr.length() == 0) continue; // new proj style
|
||||||
CWizardHandler h = new CWizardHandler(pt.getName(), pt, IMG2, parent, listener);
|
MBSWizardHandler h = new MBSWizardHandler(pt.getName(), pt, IMG2, parent, listener, wizard);
|
||||||
IConfiguration[] cfgs = pt.getConfigurations();
|
IConfiguration[] cfgs = pt.getConfigurations();
|
||||||
if (cfgs == null || cfgs.length == 0) continue;
|
if (cfgs == null || cfgs.length == 0) continue;
|
||||||
IToolChain tc = null;
|
IToolChain tc = null;
|
||||||
|
@ -80,21 +85,27 @@ public class CNewWizard extends AbstractCWizard {
|
||||||
if (tc == null) continue;
|
if (tc == null) continue;
|
||||||
h.addTc(tc);
|
h.addTc(tc);
|
||||||
|
|
||||||
TreeItem ti = null;
|
WizardItemData wd = new WizardItemData();
|
||||||
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) {
|
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) {
|
||||||
if (oldsRoot == null) {
|
if (oldsRoot == null) {
|
||||||
oldsRoot = new TreeItem(tree, SWT.NONE);
|
oldsRoot = new WizardItemData();
|
||||||
oldsRoot.setText(Messages.getString("CNewWizard.0")); //$NON-NLS-1$
|
oldsRoot.name = Messages.getString("CNewWizard.0"); //$NON-NLS-1$
|
||||||
oldsRoot.setData(new DummyHandler(parent));
|
oldsRoot.handler = null;
|
||||||
oldsRoot.setImage(IMG0);
|
oldsRoot.image =IMG0;
|
||||||
|
oldsRoot.id = oldsRoot.name;
|
||||||
|
oldsRoot.parentId = null;
|
||||||
|
items.add(oldsRoot);
|
||||||
}
|
}
|
||||||
ti = new TreeItem(oldsRoot, SWT.NONE);
|
wd.parentId = oldsRoot.id;
|
||||||
} else { // do not group to <Others>
|
} else { // do not group to <Others>
|
||||||
ti = new TreeItem(tree, SWT.NONE);
|
wd.parentId = null;
|
||||||
}
|
}
|
||||||
ti.setText(h.getName());
|
wd.name = h.getName();
|
||||||
ti.setData(h);
|
wd.handler = h;
|
||||||
ti.setImage(h.getIcon());
|
wd.image = h.getIcon();
|
||||||
|
wd.id = h.getName();
|
||||||
|
items.add(wd);
|
||||||
}
|
}
|
||||||
|
return (WizardItemData[])items.toArray(new WizardItemData[items.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class CProjectWizard extends NewModelProjectWizard {
|
public class CProjectWizard extends MBSProjectWizard {
|
||||||
|
|
||||||
public CProjectWizard() {
|
public CProjectWizard() {
|
||||||
super(Messages.getString("NewModelProjectWizard.4"), //$NON-NLS-1$
|
super(Messages.getString("NewModelProjectWizard.4"), //$NON-NLS-1$
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class is intended for data exchange between
|
* This class is intended for data exchange between
|
||||||
|
@ -25,16 +25,16 @@ import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
public class CfgHolder {
|
public class CfgHolder {
|
||||||
private static final String DELIMITER = "_with_"; //$NON-NLS-1$
|
private static final String DELIMITER = "_with_"; //$NON-NLS-1$
|
||||||
|
|
||||||
String name;
|
private String name;
|
||||||
IConfiguration cfg;
|
private IConfiguration cfg;
|
||||||
IToolChain tc;
|
private IToolChain tc;
|
||||||
|
|
||||||
public CfgHolder(IToolChain _tc, IConfiguration _cfg) {
|
public CfgHolder(IToolChain _tc, IConfiguration _cfg) {
|
||||||
tc = _tc;
|
tc = _tc;
|
||||||
cfg = _cfg;
|
cfg = _cfg;
|
||||||
if (cfg == null) {
|
if (cfg == null) {
|
||||||
if (tc == null)
|
if (tc == null)
|
||||||
name = Messages.getString("StdProjectTypeHandler.2"); //$NON-NLS-1$
|
name = UIMessages.getString("StdProjectTypeHandler.2"); //$NON-NLS-1$
|
||||||
else
|
else
|
||||||
name = tc.getName();
|
name = tc.getName();
|
||||||
} else
|
} else
|
||||||
|
@ -94,4 +94,7 @@ public class CfgHolder {
|
||||||
if (its[i].cfg != null) lst.add(its[i].cfg);
|
if (its[i].cfg != null) lst.add(its[i].cfg);
|
||||||
return (IConfiguration[])lst.toArray(new IConfiguration[lst.size()]);
|
return (IConfiguration[])lst.toArray(new IConfiguration[lst.size()]);
|
||||||
}
|
}
|
||||||
|
public Object getConfiguration() { return cfg; }
|
||||||
|
public String getName() { return name; }
|
||||||
|
public Object getToolChain() { return tc; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2007 Intel Corporation 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:
|
|
||||||
* Intel Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object is created per each Project type
|
|
||||||
*
|
|
||||||
* It is responsible for:
|
|
||||||
* - corresponding line in left pane of 1st wizard page
|
|
||||||
* - whole view of right pane, including
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class DummyHandler implements ICWizardHandler {
|
|
||||||
private static final String DUMMY = ""; //$NON-NLS-1$
|
|
||||||
Composite parent;
|
|
||||||
|
|
||||||
public DummyHandler(Composite p) {
|
|
||||||
parent = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// interface methods
|
|
||||||
public String getHeader() { return DUMMY; }
|
|
||||||
public String getName() { return DUMMY; }
|
|
||||||
public Image getIcon() { return null; }
|
|
||||||
public void handleSelection() {}
|
|
||||||
public void handleUnSelection() {}
|
|
||||||
public IWizardPage getNextPage() { return null; }
|
|
||||||
public void createProject(IProject project, CfgHolder[] cfgs) throws CoreException {}
|
|
||||||
public boolean isDummy() { return true; }
|
|
||||||
public boolean needsConfig() { return false; }
|
|
||||||
public IToolChain[] getSelectedToolChains() {return null;}
|
|
||||||
public int getToolChainsCount() { return 0; }
|
|
||||||
public void setShowProperties(boolean show) {}
|
|
||||||
public boolean showProperties() { return false; }
|
|
||||||
public IProjectType getProjectType() { return null; }
|
|
||||||
public String getPropertyId() { return null; }
|
|
||||||
public boolean canCreateWithoutToolchain() { return false; }
|
|
||||||
public void setSupportedOnly(boolean supp) {}
|
|
||||||
public boolean supportedOnly() { return true; }
|
|
||||||
public boolean isFirstPageSelected() { return false; }
|
|
||||||
public boolean supportsPreferred() {return false; }
|
|
||||||
public void updatePreferred(List prefs) {}
|
|
||||||
}
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 Intel Corporation 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:
|
||||||
|
* Intel Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build-system specific methods for Wizard Handler
|
||||||
|
*/
|
||||||
|
public interface ICBuildWizardHandler extends ICWizardHandler {
|
||||||
|
|
||||||
|
public IToolChain[] getSelectedToolChains();
|
||||||
|
public int getToolChainsCount();
|
||||||
|
public String getPropertyId();
|
||||||
|
public IProjectType getProjectType();
|
||||||
|
}
|
|
@ -345,7 +345,7 @@ public final class MBSCustomPageManager
|
||||||
MBSCustomPageData.ToolchainData[] toolchainData = page.getToolchains();
|
MBSCustomPageData.ToolchainData[] toolchainData = page.getToolchains();
|
||||||
|
|
||||||
// if no toolchains are specified then we're done
|
// if no toolchains are specified then we're done
|
||||||
if (toolchainData == null)
|
if (toolchainData == null || toolchainSet == null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,6 @@ public final class MBSCustomPageManager
|
||||||
// otherwise, iterate through the toolchains to see if one matches
|
// otherwise, iterate through the toolchains to see if one matches
|
||||||
for (int k = 0; k < toolchainData.length; k++)
|
for (int k = 0; k < toolchainData.length; k++)
|
||||||
{
|
{
|
||||||
|
|
||||||
// check all toolchains, see if there is one for which we should be present
|
// check all toolchains, see if there is one for which we should be present
|
||||||
Iterator toolchainIterator = toolchainSet.iterator();
|
Iterator toolchainIterator = toolchainSet.iterator();
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
|
* Intel corp - rework for New Project Model
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
@ -14,18 +15,17 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
|
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||||
|
import org.eclipse.cdt.ui.wizards.IWizardWithMemory;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -41,12 +41,12 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
|
||||||
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||||
|
|
||||||
public abstract class NewModelProjectWizard extends BasicNewResourceWizard implements IExecutableExtension
|
public abstract class MBSProjectWizard extends BasicNewResourceWizard
|
||||||
|
implements IExecutableExtension, IWizardWithMemory
|
||||||
{
|
{
|
||||||
private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$
|
private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$
|
||||||
private static final String OP_ERROR= "CProjectWizard.op_error"; //$NON-NLS-1$
|
private static final String OP_ERROR= "CProjectWizard.op_error"; //$NON-NLS-1$
|
||||||
|
@ -54,8 +54,7 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
private static final String message= CUIPlugin.getResourceString(OP_ERROR + ".message"); //$NON-NLS-1$
|
private static final String message= CUIPlugin.getResourceString(OP_ERROR + ".message"); //$NON-NLS-1$
|
||||||
|
|
||||||
protected IConfigurationElement fConfigElement;
|
protected IConfigurationElement fConfigElement;
|
||||||
protected CMainWizardPage fMainPage;
|
protected CDTMainWizardPage fMainPage;
|
||||||
protected CConfigWizardPage fConfigPage;
|
|
||||||
|
|
||||||
protected IProject newProject;
|
protected IProject newProject;
|
||||||
private String wz_title;
|
private String wz_title;
|
||||||
|
@ -63,16 +62,15 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
|
|
||||||
public String lastProjectName = null;
|
public String lastProjectName = null;
|
||||||
private ICWizardHandler savedHandler = null;
|
private ICWizardHandler savedHandler = null;
|
||||||
private IToolChain[] savedToolChains = null;
|
|
||||||
private boolean savedDefaults = false;
|
private boolean savedDefaults = false;
|
||||||
|
|
||||||
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
||||||
|
|
||||||
public NewModelProjectWizard() {
|
public MBSProjectWizard() {
|
||||||
this(Messages.getString("NewModelProjectWizard.0"),Messages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
this(Messages.getString("NewModelProjectWizard.0"),Messages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
public NewModelProjectWizard(String title, String desc) {
|
public MBSProjectWizard(String title, String desc) {
|
||||||
super();
|
super();
|
||||||
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
|
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
|
||||||
setNeedsProgressMonitor(true);
|
setNeedsProgressMonitor(true);
|
||||||
|
@ -81,62 +79,22 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPages() {
|
public void addPages() {
|
||||||
fConfigPage = new CConfigWizardPage();
|
fMainPage= new CDTMainWizardPage(CUIPlugin.getResourceString(PREFIX));
|
||||||
fMainPage= new CMainWizardPage(CUIPlugin.getResourceString(PREFIX), fConfigPage);
|
|
||||||
fMainPage.setTitle(wz_title);
|
fMainPage.setTitle(wz_title);
|
||||||
fMainPage.setDescription(wz_desc);
|
fMainPage.setDescription(wz_desc);
|
||||||
addPage(fMainPage);
|
addPage(fMainPage);
|
||||||
addPage(fConfigPage);
|
|
||||||
|
|
||||||
// support for custom wizard pages
|
|
||||||
MBSCustomPageManager.init();
|
MBSCustomPageManager.init();
|
||||||
MBSCustomPageManager.addStockPage(fMainPage, CMainWizardPage.PAGE_ID);
|
MBSCustomPageManager.addStockPage(fMainPage, CDTMainWizardPage.PAGE_ID);
|
||||||
MBSCustomPageManager.addStockPage(fConfigPage, CConfigWizardPage.PAGE_ID);
|
|
||||||
|
|
||||||
// Set up custom page manager to current natures settings
|
|
||||||
String[] natures = getNatures();
|
|
||||||
if (natures == null || natures.length == 0)
|
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, null);
|
|
||||||
else if (natures.length == 1)
|
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, natures[0]);
|
|
||||||
else {
|
|
||||||
Set x = new TreeSet();
|
|
||||||
for (int i=0; i<natures.length; i++) x.add(natures[i]);
|
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// load all custom pages specified via extensions
|
|
||||||
try {
|
|
||||||
MBSCustomPageManager.loadExtensions();
|
|
||||||
} catch (BuildException e) { e.printStackTrace(); }
|
|
||||||
|
|
||||||
IWizardPage[] customPages = MBSCustomPageManager.getCustomPages();
|
|
||||||
if (customPages != null) {
|
|
||||||
for (int k = 0; k < customPages.length; k++) {
|
|
||||||
addPage(customPages[k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if user has changed settings since project creation
|
* @return true if user has changed settings since project creation
|
||||||
*/
|
*/
|
||||||
private boolean isChanged() {
|
private boolean isChanged() {
|
||||||
if (savedHandler != fMainPage.h_selected || !fMainPage.getProjectName().equals(lastProjectName))
|
if (savedHandler != fMainPage.h_selected || !fMainPage.getProjectName().equals(lastProjectName))
|
||||||
return true;
|
return true;
|
||||||
IToolChain[] tcs = fMainPage.h_selected.getSelectedToolChains();
|
return savedHandler.isChanged();
|
||||||
if (savedToolChains.length != tcs.length)
|
|
||||||
return true;
|
|
||||||
for (int i=0; i<savedToolChains.length; i++) {
|
|
||||||
boolean found = false;
|
|
||||||
for (int j=0; j<tcs.length; j++) {
|
|
||||||
if (savedToolChains[i] == tcs[j]) {
|
|
||||||
found = true; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject(boolean defaults) {
|
public IProject getProject(boolean defaults) {
|
||||||
|
@ -145,7 +103,7 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
if (newProject == null) {
|
if (newProject == null) {
|
||||||
savedDefaults = defaults;
|
savedDefaults = defaults;
|
||||||
savedHandler = fMainPage.h_selected;
|
savedHandler = fMainPage.h_selected;
|
||||||
savedToolChains = fMainPage.h_selected.getSelectedToolChains();
|
savedHandler.saveState();
|
||||||
lastProjectName = fMainPage.getProjectName();
|
lastProjectName = fMainPage.getProjectName();
|
||||||
// start creation process
|
// start creation process
|
||||||
invokeRunnable(getRunnable(defaults));
|
invokeRunnable(getRunnable(defaults));
|
||||||
|
@ -203,19 +161,20 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void deleteExtraConfigs() {
|
private void deleteExtraConfigs() {
|
||||||
if (fMainPage.isCurrent()) return; // nothing to delete
|
if (fMainPage.isCurrent()) return; // nothing to delete
|
||||||
|
if (!(fMainPage.h_selected instanceof MBSWizardHandler))
|
||||||
|
return;
|
||||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(newProject, true);
|
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(newProject, true);
|
||||||
if (prjd == null) return;
|
if (prjd == null) return;
|
||||||
ICConfigurationDescription[] all = prjd.getConfigurations();
|
ICConfigurationDescription[] all = prjd.getConfigurations();
|
||||||
if (all == null) return;
|
if (all == null) return;
|
||||||
CfgHolder[] req = fConfigPage.getCfgItems(false);
|
CfgHolder[] req = ((MBSWizardHandler)fMainPage.h_selected).getCfgItems(false);
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
for (int i=0; i<all.length; i++) {
|
for (int i=0; i<all.length; i++) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (int j=0; j<req.length; j++) {
|
for (int j=0; j<req.length; j++) {
|
||||||
if (all[i].getName().equals(req[j].name)) {
|
if (all[i].getName().equals(req[j].getName())) {
|
||||||
found = true; break;
|
found = true; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +214,7 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
try {
|
try {
|
||||||
newProject = createIProject(lastProjectName, fMainPage.getProjectLocation());
|
newProject = createIProject(lastProjectName, fMainPage.getProjectLocation());
|
||||||
if (newProject != null)
|
if (newProject != null)
|
||||||
fMainPage.h_selected.createProject(newProject, fConfigPage.getCfgItems(defaults));
|
fMainPage.h_selected.createProject(newProject, defaults);
|
||||||
} catch (CoreException e) { ManagedBuilderUIPlugin.log(e); }
|
} catch (CoreException e) { ManagedBuilderUIPlugin.log(e); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -301,4 +260,22 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
||||||
|
|
||||||
protected abstract IProject continueCreation(IProject prj);
|
protected abstract IProject continueCreation(IProject prj);
|
||||||
protected abstract String[] getNatures();
|
protected abstract String[] getNatures();
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
fMainPage.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canFinish() {
|
||||||
|
if (fMainPage.h_selected != null) {
|
||||||
|
String s = fMainPage.h_selected.getErrorMessage();
|
||||||
|
if (s != null) return false;
|
||||||
|
}
|
||||||
|
return super.canFinish();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns last project name used for creation
|
||||||
|
*/
|
||||||
|
public String getLastProjectName() {
|
||||||
|
return lastProjectName;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -29,14 +29,18 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIImages;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CWizardHandler;
|
||||||
|
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -53,47 +57,36 @@ import org.eclipse.swt.widgets.TableItem;
|
||||||
* - whole view of right pane, including
|
* - whole view of right pane, including
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CWizardHandler implements ICWizardHandler {
|
public class MBSWizardHandler extends CWizardHandler implements ICBuildWizardHandler {
|
||||||
private static final Image IMG0 = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_EMPTY);
|
|
||||||
private static final Image IMG1 = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_PREFERRED);
|
|
||||||
private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$
|
private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$
|
||||||
private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$
|
private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
private static final String head = Messages.getString("CWizardHandler.0"); //$NON-NLS-1$
|
|
||||||
private static final String tooltip =
|
private static final String tooltip =
|
||||||
Messages.getString("CWizardHandler.1")+ //$NON-NLS-1$
|
Messages.getString("CWizardHandler.1")+ //$NON-NLS-1$
|
||||||
Messages.getString("CWizardHandler.2") + //$NON-NLS-1$
|
Messages.getString("CWizardHandler.2") + //$NON-NLS-1$
|
||||||
Messages.getString("CWizardHandler.3") + //$NON-NLS-1$
|
Messages.getString("CWizardHandler.3") + //$NON-NLS-1$
|
||||||
Messages.getString("CWizardHandler.4") + //$NON-NLS-1$
|
Messages.getString("CWizardHandler.4") + //$NON-NLS-1$
|
||||||
Messages.getString("CWizardHandler.5"); //$NON-NLS-1$
|
Messages.getString("CWizardHandler.5"); //$NON-NLS-1$
|
||||||
|
|
||||||
protected SortedMap tcs;
|
protected SortedMap tcs = new TreeMap();
|
||||||
private String name;
|
|
||||||
private Image image;
|
|
||||||
private Composite parent;
|
|
||||||
protected Table table;
|
|
||||||
private String propertyId = null;
|
private String propertyId = null;
|
||||||
private IProjectType pt = null;
|
private IProjectType pt = null;
|
||||||
private IToolChainListListener listener;
|
protected IWizardItemsListListener listener;
|
||||||
private boolean supportedOnly = true;
|
protected CDTConfigWizardPage fConfigPage;
|
||||||
|
private IToolChain[] savedToolChains = null;
|
||||||
|
private IWizard wizard;
|
||||||
|
|
||||||
public CWizardHandler(String _name, IProjectType _pt, Image _image, Composite p, IToolChainListListener _listener) {
|
public MBSWizardHandler(String _name, IProjectType _pt, Image _image, Composite p, IWizardItemsListListener _listener, IWizard w) {
|
||||||
tcs = new TreeMap();
|
super(p, Messages.getString("CWizardHandler.0"), _name, _image); //$NON-NLS-1$
|
||||||
name = _name;
|
|
||||||
image = _image;
|
|
||||||
parent = p;
|
|
||||||
pt = _pt;
|
pt = _pt;
|
||||||
listener = _listener;
|
listener = _listener;
|
||||||
|
wizard = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CWizardHandler(IBuildPropertyValue val, Image _image, Composite p, IToolChainListListener _listener) {
|
public MBSWizardHandler(IBuildPropertyValue val, Image _image, Composite p, IWizardItemsListListener _listener, IWizard w) {
|
||||||
tcs = new TreeMap();
|
super(p, Messages.getString("CWizardHandler.0"), val.getName(), _image); //$NON-NLS-1$
|
||||||
name = val.getName();
|
|
||||||
propertyId = val.getId();
|
propertyId = val.getId();
|
||||||
image = _image;
|
|
||||||
parent = p;
|
|
||||||
listener = _listener;
|
listener = _listener;
|
||||||
|
wizard = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSelection() {
|
public void handleSelection() {
|
||||||
|
@ -134,12 +127,14 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
updatePreferred(preferred);
|
updatePreferred(preferred);
|
||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
parent.layout();
|
parent.layout();
|
||||||
|
if (fConfigPage != null) fConfigPage.pagesLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleUnSelection() {
|
public void handleUnSelection() {
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
table.setVisible(false);
|
table.setVisible(false);
|
||||||
}
|
}
|
||||||
|
if (fConfigPage != null) fConfigPage.pagesLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTc(IToolChain tc) {
|
public void addTc(IToolChain tc) {
|
||||||
|
@ -156,35 +151,22 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
tcs.put(tc.getUniqueRealName(), tc);
|
tcs.put(tc.getUniqueRealName(), tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IToolChain[] getSelectedToolChains() {
|
public void createProject(IProject project, boolean defaults) throws CoreException {
|
||||||
if (tcs.size() == 0)
|
|
||||||
return null;
|
|
||||||
else {
|
|
||||||
TableItem[] sel = table.getSelection();
|
|
||||||
IToolChain[] out = new IToolChain[sel.length];
|
|
||||||
for (int i=0; i< sel.length; i++)
|
|
||||||
out[i] = (IToolChain)sel[i].getData();
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createProject(IProject project, CfgHolder[] cfgs) throws CoreException {
|
|
||||||
CoreModel coreModel = CoreModel.getDefault();
|
CoreModel coreModel = CoreModel.getDefault();
|
||||||
// ICProjectDescription des = coreModel.getProjectDescription(project);
|
CfgHolder[] cfgs = fConfigPage.getCfgItems(defaults);
|
||||||
// des = coreModel.createProjectDescription(project, true);
|
|
||||||
ICProjectDescription des = coreModel.createProjectDescription(project, false);
|
ICProjectDescription des = coreModel.createProjectDescription(project, false);
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
|
|
||||||
if (cfgs == null || cfgs.length == 0)
|
if (cfgs == null || cfgs.length == 0)
|
||||||
cfgs = CConfigWizardPage.getDefaultCfgs(this);
|
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
|
||||||
|
|
||||||
if (cfgs[0].cfg == null) {
|
if (cfgs[0].getConfiguration() == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR,
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
||||||
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
Configuration cf = (Configuration)cfgs[0].getConfiguration();
|
||||||
ManagedProject mProj = new ManagedProject(project, cfgs[0].cfg.getProjectType());
|
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
|
||||||
info.setManagedProject(mProj);
|
info.setManagedProject(mProj);
|
||||||
|
|
||||||
cfgs = CfgHolder.unique(cfgs);
|
cfgs = CfgHolder.unique(cfgs);
|
||||||
|
@ -192,8 +174,9 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
ICConfigurationDescription active = null;
|
ICConfigurationDescription active = null;
|
||||||
|
|
||||||
for(int i = 0; i < cfgs.length; i++){
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
String id = ManagedBuildManager.calculateChildId(cfgs[i].cfg.getId(), null);
|
cf = (Configuration)cfgs[i].getConfiguration();
|
||||||
Configuration config = new Configuration(mProj, (Configuration)cfgs[i].cfg, id, false, true);
|
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
|
||||||
|
Configuration config = new Configuration(mProj, cf, id, false, true);
|
||||||
CConfigurationData data = config.getConfigurationData();
|
CConfigurationData data = config.getConfigurationData();
|
||||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
config.setConfigurationDescription(cfgDes);
|
config.setConfigurationDescription(cfgDes);
|
||||||
|
@ -203,7 +186,7 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
if (bld != null) { bld.setManagedBuildOn(true); }
|
if (bld != null) { bld.setManagedBuildOn(true); }
|
||||||
|
|
||||||
String s = project.getName();
|
String s = project.getName();
|
||||||
config.setName(cfgs[i].name);
|
config.setName(cfgs[i].getName());
|
||||||
config.setArtifactName(s);
|
config.setArtifactName(s);
|
||||||
|
|
||||||
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
||||||
|
@ -216,20 +199,12 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface methods
|
public IWizardPage getSpecificPage() {
|
||||||
|
if (fConfigPage == null) {
|
||||||
public String getHeader() { return head; }
|
fConfigPage = new CDTConfigWizardPage(this);
|
||||||
public String getName() { return name; }
|
}
|
||||||
public Image getIcon() { return image; }
|
return fConfigPage;
|
||||||
public boolean isDummy() { return false; }
|
}
|
||||||
public int getToolChainsCount() { return tcs.size(); }
|
|
||||||
public IProjectType getProjectType() { return pt; }
|
|
||||||
public String getPropertyId() { return propertyId; }
|
|
||||||
public boolean canCreateWithoutToolchain() { return false; }
|
|
||||||
|
|
||||||
public void setSupportedOnly(boolean supp) { supportedOnly = supp;}
|
|
||||||
public boolean supportedOnly() { return supportedOnly; }
|
|
||||||
public boolean supportsPreferred() { return true; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark preferred toolchains with specific images
|
* Mark preferred toolchains with specific images
|
||||||
|
@ -243,4 +218,66 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
ti.setImage( prefs.contains(id) ? IMG1 : IMG0);
|
ti.setImage( prefs.contains(id) ? IMG1 : IMG0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public String getHeader() { return head; }
|
||||||
|
public String getName() { return name; }
|
||||||
|
public Image getIcon() { return image; }
|
||||||
|
public boolean isDummy() { return false; }
|
||||||
|
public boolean supportsPreferred() { return true; }
|
||||||
|
|
||||||
|
public boolean isChanged() {
|
||||||
|
IToolChain[] tcs = getSelectedToolChains();
|
||||||
|
if (savedToolChains.length != tcs.length)
|
||||||
|
return true;
|
||||||
|
for (int i=0; i<savedToolChains.length; i++) {
|
||||||
|
boolean found = false;
|
||||||
|
for (int j=0; j<tcs.length; j++) {
|
||||||
|
if (savedToolChains[i] == tcs[j]) {
|
||||||
|
found = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveState() {
|
||||||
|
savedToolChains = getSelectedToolChains();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Methods specific for MBSWizardHandler
|
||||||
|
|
||||||
|
public IToolChain[] getSelectedToolChains() {
|
||||||
|
TableItem[] tis = table.getSelection();
|
||||||
|
if (tis == null || tis.length == 0)
|
||||||
|
return new IToolChain[0];
|
||||||
|
IToolChain[] ts = new IToolChain[tis.length];
|
||||||
|
for (int i=0; i<tis.length; i++) {
|
||||||
|
ts[i] = (IToolChain)tis[i].getData();
|
||||||
|
}
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
public int getToolChainsCount() {
|
||||||
|
return tcs.size();
|
||||||
|
}
|
||||||
|
public String getPropertyId() {
|
||||||
|
return propertyId;
|
||||||
|
}
|
||||||
|
public IProjectType getProjectType() {
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
public IWizard getWizard() {
|
||||||
|
return wizard;
|
||||||
|
}
|
||||||
|
public CfgHolder[] getCfgItems(boolean defaults) {
|
||||||
|
return fConfigPage.getCfgItems(defaults);
|
||||||
|
}
|
||||||
|
public String getErrorMessage() {
|
||||||
|
TableItem[] tis = table.getSelection();
|
||||||
|
if (tis == null || tis.length == 0)
|
||||||
|
return Messages.getString("MBSWizardHandler.0"); //$NON-NLS-1$
|
||||||
|
if (fConfigPage != null && fConfigPage.isVisible && !fConfigPage.isCustomPageComplete())
|
||||||
|
return UIMessages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,21 +21,22 @@ import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
public class StdProjectTypeHandler extends CWizardHandler {
|
public class STDWizardHandler extends MBSWizardHandler {
|
||||||
|
|
||||||
public StdProjectTypeHandler(String _name, Image _image, Composite p) {
|
public STDWizardHandler(String _name, Image _image, Composite p, IWizard w) {
|
||||||
super(_name, null, _image, p, null);
|
super(_name, null, _image, p, null, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTc(IToolChain tc) {
|
public void addTc(IToolChain tc) {
|
||||||
if (tc == null) {
|
if (tc == null) {
|
||||||
tcs.put(Messages.getString("StdProjectTypeHandler.0"), null); //$NON-NLS-1$
|
tcs.put(UIMessages.getString("StdProjectTypeHandler.0"), null); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
if (tc.isAbstract() || tc.isSystemObject()) return;
|
if (tc.isAbstract() || tc.isSystemObject()) return;
|
||||||
// unlike CWizardHandler, we don't check for configs
|
// unlike CWizardHandler, we don't check for configs
|
||||||
|
@ -46,18 +47,18 @@ public class StdProjectTypeHandler extends CWizardHandler {
|
||||||
/**
|
/**
|
||||||
* Note that configurations parameter is ignored
|
* Note that configurations parameter is ignored
|
||||||
*/
|
*/
|
||||||
public void createProject(IProject project, CfgHolder[] cfgs) throws CoreException {
|
public void createProject(IProject project, boolean defaults) throws CoreException {
|
||||||
CoreModel coreModel = CoreModel.getDefault();
|
CoreModel coreModel = CoreModel.getDefault();
|
||||||
// ICProjectDescription des = coreModel.getProjectDescription(project);
|
|
||||||
// des = coreModel.createProjectDescription(project, true);
|
|
||||||
ICProjectDescription des = coreModel.createProjectDescription(project, false);
|
ICProjectDescription des = coreModel.createProjectDescription(project, false);
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
ManagedProject mProj = new ManagedProject(des);
|
ManagedProject mProj = new ManagedProject(des);
|
||||||
info.setManagedProject(mProj);
|
info.setManagedProject(mProj);
|
||||||
|
|
||||||
|
CfgHolder[] cfgs = fConfigPage.getCfgItems(defaults);
|
||||||
|
|
||||||
for (int i=0; i<cfgs.length; i++) {
|
for (int i=0; i<cfgs.length; i++) {
|
||||||
String s = (cfgs[i].tc == null) ? "0" : cfgs[i].tc.getId(); //$NON-NLS-1$
|
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
||||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].tc, ManagedBuildManager.calculateChildId(s, null), cfgs[i].name);
|
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
||||||
IBuilder bld = cfg.getEditableBuilder();
|
IBuilder bld = cfg.getEditableBuilder();
|
||||||
if (bld != null) {
|
if (bld != null) {
|
||||||
if(bld.isInternalBuilder()){
|
if(bld.isInternalBuilder()){
|
||||||
|
@ -69,7 +70,7 @@ public class StdProjectTypeHandler extends CWizardHandler {
|
||||||
}
|
}
|
||||||
bld.setManagedBuildOn(false);
|
bld.setManagedBuildOn(false);
|
||||||
} else {
|
} else {
|
||||||
System.out.println(Messages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
|
System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
cfg.setArtifactName(project.getName());
|
cfg.setArtifactName(project.getName());
|
||||||
CConfigurationData data = cfg.getConfigurationData();
|
CConfigurationData data = cfg.getConfigurationData();
|
||||||
|
@ -88,5 +89,4 @@ public class StdProjectTypeHandler extends CWizardHandler {
|
||||||
else
|
else
|
||||||
return super.getSelectedToolChains();
|
return super.getSelectedToolChains();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -13,21 +13,23 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.cdt.ui.wizards.WizardItemData;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
import org.eclipse.swt.widgets.TreeItem;
|
|
||||||
|
|
||||||
public class StdBuildWizard extends AbstractCWizard {
|
public class StdBuildWizard extends AbstractCWizard {
|
||||||
|
|
||||||
public void createItems(Tree tree, boolean supportedOnly) {
|
public WizardItemData[] createItems(boolean supportedOnly, IWizard wizard) {
|
||||||
StdProjectTypeHandler h = new StdProjectTypeHandler(Messages.getString("StdBuildWizard.0"), IMG0, parent); //$NON-NLS-1$
|
STDWizardHandler h = new STDWizardHandler(Messages.getString("StdBuildWizard.0"), IMG0, parent, wizard); //$NON-NLS-1$
|
||||||
h.addTc(null); // add default toolchain
|
h.addTc(null); // add default toolchain
|
||||||
IToolChain[] tcs = ManagedBuildManager.getRealToolChains();
|
IToolChain[] tcs = ManagedBuildManager.getRealToolChains();
|
||||||
for (int i=0; i<tcs.length; i++)
|
for (int i=0; i<tcs.length; i++)
|
||||||
if (!supportedOnly || isValid(tcs[i])) h.addTc(tcs[i]);
|
if (!supportedOnly || isValid(tcs[i])) h.addTc(tcs[i]);
|
||||||
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
WizardItemData wd = new WizardItemData();
|
||||||
ti.setText(h.getName());
|
wd.name = h.getName();
|
||||||
ti.setData(h);
|
wd.handler = h;
|
||||||
ti.setImage(h.getIcon());
|
wd.image = h.getIcon();
|
||||||
|
wd.id = h.getName();
|
||||||
|
wd.parentId = null;
|
||||||
|
return new WizardItemData[] {wd};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,3 +397,4 @@ page.c.general=C/C++ General
|
||||||
# menu labels
|
# menu labels
|
||||||
Configurations.menu=Build configurations
|
Configurations.menu=Build configurations
|
||||||
Index.menu=Index
|
Index.menu=Index
|
||||||
|
CDTWizard=CDT New Project Wizard
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<extension-point id="PathContainerPage" name="%pathContainerPage" schema="schema/PathContainerPage.exsd"/>
|
<extension-point id="PathContainerPage" name="%pathContainerPage" schema="schema/PathContainerPage.exsd"/>
|
||||||
<extension-point id="foldingStructureProviders" name="%foldingStructureProvidersExtensionPoint" schema="schema/foldingStructureProviders.exsd"/>
|
<extension-point id="foldingStructureProviders" name="%foldingStructureProvidersExtensionPoint" schema="schema/foldingStructureProviders.exsd"/>
|
||||||
<extension-point id="cPropertyTab" name="%cPropertyTabName" schema="schema/cPropertyTab.exsd"/>
|
<extension-point id="cPropertyTab" name="%cPropertyTabName" schema="schema/cPropertyTab.exsd"/>
|
||||||
|
<extension-point id="CDTWizard" name="%CDTWizard" schema="schema/CDTWizard.exsd"/>
|
||||||
|
|
||||||
<!-- =========================================================================== -->
|
<!-- =========================================================================== -->
|
||||||
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
|
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
package org.eclipse.cdt.ui.newui;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
|
@ -495,3 +495,44 @@ StructureTreeTab.9=Value
|
||||||
StructureTreeTab.10=Class
|
StructureTreeTab.10=Class
|
||||||
StructureTreeTab.11=Wait...
|
StructureTreeTab.11=Wait...
|
||||||
PrefPage_PropertyPage.0=These settings will affect behaviour of CDT property pages
|
PrefPage_PropertyPage.0=These settings will affect behaviour of CDT property pages
|
||||||
|
|
||||||
|
CConfigWizardPage.0=Select Configurations
|
||||||
|
CConfigWizardPage.1=Select platforms and configurations you wish to deploy on
|
||||||
|
CConfigWizardPage.4=Project type:
|
||||||
|
CConfigWizardPage.5=Tool-chains:
|
||||||
|
CConfigWizardPage.6=Configurations:
|
||||||
|
CConfigWizardPage.7=Select all
|
||||||
|
CConfigWizardPage.8=Deselect all
|
||||||
|
CConfigWizardPage.9=Edit properties after project creation
|
||||||
|
CConfigWizardPage.10=At least one configuration should be available. Project cannot be created.
|
||||||
|
CConfigWizardPage.11=At least one configuration should be selected. Please check needed configurations.
|
||||||
|
CConfigWizardPage.12=Use "Advanced settings" button to edit project's properties.\n\nAdditional configurations can be added after project creation.\nUse "Manage configurations" buttons either on toolbar or on property pages.
|
||||||
|
CConfigWizardPage.13=Advanced settings...
|
||||||
|
|
||||||
|
CMainWizardPage.0=Project types:
|
||||||
|
CMainWizardPage.1=Show project types and toolchains only if they are supported on the platform
|
||||||
|
CMainWizardPage.10=A project with that name already exists in the workspace.
|
||||||
|
CMainWizardPage.2=Edit properties after project creation
|
||||||
|
CMainWizardPage.3=No project types available. Project cannot be created
|
||||||
|
CMainWizardPage.5=Cannot create ICProjectTypeHandler :
|
||||||
|
CMainWizardPage.6=File with specified name already exists \!
|
||||||
|
CMainWizardPage.7=Directory with specified name already exists \!
|
||||||
|
CMainWizardPage.8=Project name:
|
||||||
|
CMainWizardPage.9=Project name is empty
|
||||||
|
|
||||||
|
ProjectContentsArea.0=Browse...
|
||||||
|
ProjectContentsArea.1=Use default location
|
||||||
|
ProjectContentsArea.2=Location:
|
||||||
|
ProjectContentsArea.3=Choose file system:
|
||||||
|
ProjectContentsArea.3=Invalid location path
|
||||||
|
ProjectContentsArea.4=Project contents directory must be specified
|
||||||
|
ProjectContentsArea.5=Select directory:
|
||||||
|
ProjectContentsArea.6=Project path should be absolute
|
||||||
|
ProjectContentsArea.7=Project path is not valid
|
||||||
|
ProjectContentsArea.8=Cannot create given path
|
||||||
|
ProjectContentsArea.9=File with given name already exists
|
||||||
|
StdProjectTypeHandler.0=-- Other Toolchain --
|
||||||
|
StdProjectTypeHandler.2=Default
|
||||||
|
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||||
|
|
||||||
|
CDTConfigWizardPage.0=Select configurations
|
||||||
|
|
|
@ -9,15 +9,13 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Intel corporation - cloned to CDT UI, to avoid discouraged access
|
* Intel corporation - cloned to CDT UI, to avoid discouraged access
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.newui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.cdt.ui.newui.AbstractPage;
|
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -41,14 +39,14 @@ import org.eclipse.swt.widgets.Text;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProjectContentsArea {
|
public class ProjectContentsArea {
|
||||||
private static final String ERROR_INVALID_PATH = Messages.getString("ProjectContentsArea.3"); //$NON-NLS-1$
|
private static final String ERROR_INVALID_PATH = UIMessages.getString("ProjectContentsArea.3"); //$NON-NLS-1$
|
||||||
private static final String ERROR_PATH_EMPTY = Messages.getString("ProjectContentsArea.4"); //$NON-NLS-1$
|
private static final String ERROR_PATH_EMPTY = UIMessages.getString("ProjectContentsArea.4"); //$NON-NLS-1$
|
||||||
private static final String ERROR_NOT_ABSOLUTE = Messages.getString("ProjectContentsArea.6"); //$NON-NLS-1$
|
private static final String ERROR_NOT_ABSOLUTE = UIMessages.getString("ProjectContentsArea.6"); //$NON-NLS-1$
|
||||||
private static final String ERROR_NOT_VALID = Messages.getString("ProjectContentsArea.7"); //$NON-NLS-1$
|
private static final String ERROR_NOT_VALID = UIMessages.getString("ProjectContentsArea.7"); //$NON-NLS-1$
|
||||||
private static final String ERROR_CANNOT_CREATE = Messages.getString("ProjectContentsArea.8"); //$NON-NLS-1$
|
private static final String ERROR_CANNOT_CREATE = UIMessages.getString("ProjectContentsArea.8"); //$NON-NLS-1$
|
||||||
private static final String ERROR_FILE_EXISTS = Messages.getString("ProjectContentsArea.9"); //$NON-NLS-1$
|
private static final String ERROR_FILE_EXISTS = UIMessages.getString("ProjectContentsArea.9"); //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String BROWSE_LABEL = Messages.getString("ProjectContentsArea.0"); //$NON-NLS-1$
|
private static final String BROWSE_LABEL = UIMessages.getString("ProjectContentsArea.0"); //$NON-NLS-1$
|
||||||
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
|
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
|
||||||
private static final String FILE_SCHEME = "file"; //$NON-NLS-1$
|
private static final String FILE_SCHEME = "file"; //$NON-NLS-1$
|
||||||
private Label locationLabel;
|
private Label locationLabel;
|
||||||
|
@ -85,7 +83,7 @@ public class ProjectContentsArea {
|
||||||
projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
|
useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
|
||||||
useDefaultsButton.setText(Messages.getString("ProjectContentsArea.1")); //$NON-NLS-1$
|
useDefaultsButton.setText(UIMessages.getString("ProjectContentsArea.1")); //$NON-NLS-1$
|
||||||
useDefaultsButton.setSelection(defaultEnabled);
|
useDefaultsButton.setSelection(defaultEnabled);
|
||||||
GridData buttonData = new GridData();
|
GridData buttonData = new GridData();
|
||||||
buttonData.horizontalSpan = 4;
|
buttonData.horizontalSpan = 4;
|
||||||
|
@ -129,7 +127,7 @@ public class ProjectContentsArea {
|
||||||
private void createUserEntryArea(Composite composite, boolean defaultEnabled) {
|
private void createUserEntryArea(Composite composite, boolean defaultEnabled) {
|
||||||
// location label
|
// location label
|
||||||
locationLabel = new Label(composite, SWT.NONE);
|
locationLabel = new Label(composite, SWT.NONE);
|
||||||
locationLabel.setText(Messages.getString("ProjectContentsArea.2")); //$NON-NLS-1$
|
locationLabel.setText(UIMessages.getString("ProjectContentsArea.2")); //$NON-NLS-1$
|
||||||
|
|
||||||
// project location entry field
|
// project location entry field
|
||||||
locationPathField = new Text(composite, SWT.BORDER);
|
locationPathField = new Text(composite, SWT.BORDER);
|
||||||
|
@ -222,7 +220,7 @@ public class ProjectContentsArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
|
DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
|
||||||
dialog.setMessage(Messages.getString("ProjectContentsArea.5")); //$NON-NLS-1$
|
dialog.setMessage(UIMessages.getString("ProjectContentsArea.5")); //$NON-NLS-1$
|
||||||
dialog.setFilterPath(dirName);
|
dialog.setFilterPath(dirName);
|
||||||
selectedDirectory = dialog.open();
|
selectedDirectory = dialog.open();
|
||||||
|
|
|
@ -8,16 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Set;
|
import java.util.ArrayList;
|
||||||
import java.util.TreeSet;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.PageLayout;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.wizards.ProjectContentsArea.IErrorMessageReporter;
|
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
@ -30,6 +25,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -47,11 +43,17 @@ import org.eclipse.swt.widgets.Tree;
|
||||||
import org.eclipse.swt.widgets.TreeItem;
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
public class CMainWizardPage extends WizardPage implements IToolChainListListener {
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
import org.eclipse.cdt.ui.newui.PageLayout;
|
||||||
|
import org.eclipse.cdt.ui.newui.ProjectContentsArea;
|
||||||
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
import org.eclipse.cdt.ui.newui.ProjectContentsArea.IErrorMessageReporter;
|
||||||
|
|
||||||
|
public class CDTMainWizardPage extends WizardPage implements IWizardItemsListListener {
|
||||||
|
|
||||||
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.NewModelProjectWizardPage"; //$NON-NLS-1$
|
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.NewModelProjectWizardPage"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.managedbuilder.ui.CDTWizard"; //$NON-NLS-1$
|
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.CDTWizard"; //$NON-NLS-1$
|
||||||
private static final String ELEMENT_NAME = "wizard"; //$NON-NLS-1$
|
private static final String ELEMENT_NAME = "wizard"; //$NON-NLS-1$
|
||||||
private static final String CLASS_NAME = "class"; //$NON-NLS-1$
|
private static final String CLASS_NAME = "class"; //$NON-NLS-1$
|
||||||
private static final String HELP_CTX = "org.eclipse.ui.ide.new_project_wizard_page_context"; //$NON-NLS-1$
|
private static final String HELP_CTX = "org.eclipse.ui.ide.new_project_wizard_page_context"; //$NON-NLS-1$
|
||||||
|
@ -68,19 +70,17 @@ import org.eclipse.ui.PlatformUI;
|
||||||
private Button show_sup;
|
private Button show_sup;
|
||||||
private Label right_label;
|
private Label right_label;
|
||||||
|
|
||||||
private CConfigWizardPage next;
|
|
||||||
private ProjectContentsArea locationArea;
|
private ProjectContentsArea locationArea;
|
||||||
protected ICWizardHandler h_selected = null;
|
public ICWizardHandler h_selected = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new project creation wizard page.
|
* Creates a new project creation wizard page.
|
||||||
*
|
*
|
||||||
* @param pageName the name of this page
|
* @param pageName the name of this page
|
||||||
*/
|
*/
|
||||||
public CMainWizardPage(String pageName, CConfigWizardPage _next) {
|
public CDTMainWizardPage(String pageName) {
|
||||||
super(pageName);
|
super(pageName);
|
||||||
setPageComplete(false);
|
setPageComplete(false);
|
||||||
next = _next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** (non-Javadoc)
|
/** (non-Javadoc)
|
||||||
|
@ -107,7 +107,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
createDynamicGroup(composite);
|
createDynamicGroup(composite);
|
||||||
|
|
||||||
switchTo(updateData(tree, right, show_sup, CMainWizardPage.this));
|
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()));
|
||||||
|
|
||||||
setPageComplete(validatePage());
|
setPageComplete(validatePage());
|
||||||
// Show description on opening
|
// Show description on opening
|
||||||
|
@ -122,7 +122,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
c.setLayout(new GridLayout(2, true));
|
c.setLayout(new GridLayout(2, true));
|
||||||
|
|
||||||
Label l1 = new Label(c, SWT.NONE);
|
Label l1 = new Label(c, SWT.NONE);
|
||||||
l1.setText(Messages.getString("CMainWizardPage.0")); //$NON-NLS-1$
|
l1.setText(UIMessages.getString("CMainWizardPage.0")); //$NON-NLS-1$
|
||||||
l1.setFont(parent.getFont());
|
l1.setFont(parent.getFont());
|
||||||
l1.setLayoutData(new GridData(GridData.BEGINNING));
|
l1.setLayoutData(new GridData(GridData.BEGINNING));
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
right.setLayout(new PageLayout());
|
right.setLayout(new PageLayout());
|
||||||
|
|
||||||
show_sup = new Button(c, SWT.CHECK);
|
show_sup = new Button(c, SWT.CHECK);
|
||||||
show_sup.setText(Messages.getString("CMainWizardPage.1")); //$NON-NLS-1$
|
show_sup.setText(UIMessages.getString("CMainWizardPage.1")); //$NON-NLS-1$
|
||||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
show_sup.setLayoutData(gd);
|
show_sup.setLayoutData(gd);
|
||||||
|
@ -153,7 +153,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (h_selected != null)
|
if (h_selected != null)
|
||||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
switchTo(updateData(tree, right, show_sup, CMainWizardPage.this));
|
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()));
|
||||||
}} );
|
}} );
|
||||||
|
|
||||||
// restore settings from preferences
|
// restore settings from preferences
|
||||||
|
@ -176,9 +176,9 @@ import org.eclipse.ui.PlatformUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IWizardPage getNextPage() {
|
public IWizardPage getNextPage() {
|
||||||
if (h_selected == null || h_selected.isDummy()) // cannot continue
|
if (h_selected == null) // cannot continue
|
||||||
return null;
|
return null;
|
||||||
return next;
|
return h_selected.getSpecificPage();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates the project name specification controls.
|
* Creates the project name specification controls.
|
||||||
|
@ -195,7 +195,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
// new project label
|
// new project label
|
||||||
Label projectLabel = new Label(projectGroup, SWT.NONE);
|
Label projectLabel = new Label(projectGroup, SWT.NONE);
|
||||||
projectLabel.setText(Messages.getString("CMainWizardPage.8")); //$NON-NLS-1$
|
projectLabel.setText(UIMessages.getString("CMainWizardPage.8")); //$NON-NLS-1$
|
||||||
projectLabel.setFont(parent.getFont());
|
projectLabel.setFont(parent.getFont());
|
||||||
|
|
||||||
// new project name entry field
|
// new project name entry field
|
||||||
|
@ -304,7 +304,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
String projectFieldContents = getProjectNameFieldValue();
|
String projectFieldContents = getProjectNameFieldValue();
|
||||||
if (projectFieldContents.length() == 0) {
|
if (projectFieldContents.length() == 0) {
|
||||||
setErrorMessage(Messages.getString("CMainWizardPage.9")); //$NON-NLS-1$
|
setErrorMessage(UIMessages.getString("CMainWizardPage.9")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,13 +319,13 @@ import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
IProject handle = getProjectHandle();
|
IProject handle = getProjectHandle();
|
||||||
if (handle.exists()) {
|
if (handle.exists()) {
|
||||||
if (getWizard() instanceof NewModelProjectWizard) {
|
if (getWizard() instanceof IWizardWithMemory) {
|
||||||
NewModelProjectWizard w = (NewModelProjectWizard)getWizard();
|
IWizardWithMemory w = (IWizardWithMemory)getWizard();
|
||||||
if (w.lastProjectName != null && w.lastProjectName.equals(getProjectName()))
|
if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName()))
|
||||||
bad = false;
|
bad = false;
|
||||||
}
|
}
|
||||||
if (bad) {
|
if (bad) {
|
||||||
setErrorMessage(Messages.getString("CMainWizardPage.10")); //$NON-NLS-1$
|
setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,9 +336,9 @@ import org.eclipse.ui.PlatformUI;
|
||||||
File f = p.append(getProjectName()).toFile();
|
File f = p.append(getProjectName()).toFile();
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
if (f.isDirectory())
|
if (f.isDirectory())
|
||||||
setErrorMessage(Messages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
||||||
else
|
else
|
||||||
setErrorMessage(Messages.getString("CMainWizardPage.7")); //$NON-NLS-1$
|
setErrorMessage(UIMessages.getString("CMainWizardPage.7")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,23 +353,20 @@ import org.eclipse.ui.PlatformUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tree.getItemCount() == 0) {
|
if (tree.getItemCount() == 0) {
|
||||||
setErrorMessage(Messages.getString("CMainWizardPage.3")); //$NON-NLS-1$
|
setErrorMessage(UIMessages.getString("CMainWizardPage.3")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// it is not an error, but we cannot continue
|
// it is not an error, but we cannot continue
|
||||||
if (h_selected == null || h_selected.isDummy()) {
|
if (h_selected == null) {
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! h_selected.canCreateWithoutToolchain()) {
|
String s = h_selected.getErrorMessage();
|
||||||
IToolChain tcs[] = h_selected.getSelectedToolChains();
|
if (s != null) {
|
||||||
int cnt = tcs != null ? tcs.length : 0;
|
setErrorMessage(s);
|
||||||
if (cnt == 0) {
|
return false;
|
||||||
setErrorMessage(Messages.getString("CMainWizardPage.4")); //$NON-NLS-1$
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
@ -392,7 +389,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
return locationArea.isDefault();
|
return locationArea.isDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICWizardHandler updateData(Tree tree, Composite right, Button show_sup, IToolChainListListener ls) {
|
public static ICWizardHandler updateData(Tree tree, Composite right, Button show_sup, IWizardItemsListListener ls, IWizard wizard) {
|
||||||
// remember selected item
|
// remember selected item
|
||||||
TreeItem[] sel = tree.getSelection();
|
TreeItem[] sel = tree.getSelection();
|
||||||
String savedStr = (sel.length > 0) ? sel[0].getText() : null;
|
String savedStr = (sel.length > 0) ? sel[0].getText() : null;
|
||||||
|
@ -403,6 +400,8 @@ import org.eclipse.ui.PlatformUI;
|
||||||
if (extensionPoint == null) return null;
|
if (extensionPoint == null) return null;
|
||||||
IExtension[] extensions = extensionPoint.getExtensions();
|
IExtension[] extensions = extensionPoint.getExtensions();
|
||||||
if (extensions == null) return null;
|
if (extensions == null) return null;
|
||||||
|
|
||||||
|
ArrayList items = new ArrayList();
|
||||||
for (int i = 0; i < extensions.length; ++i) {
|
for (int i = 0; i < extensions.length; ++i) {
|
||||||
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
|
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
|
||||||
for (int k = 0; k < elements.length; k++) {
|
for (int k = 0; k < elements.length; k++) {
|
||||||
|
@ -411,16 +410,20 @@ import org.eclipse.ui.PlatformUI;
|
||||||
try {
|
try {
|
||||||
w = (ICNewWizard) elements[k].createExecutableExtension(CLASS_NAME);
|
w = (ICNewWizard) elements[k].createExecutableExtension(CLASS_NAME);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
System.out.println(Messages.getString("CMainWizardPage.5") + e.getLocalizedMessage()); //$NON-NLS-1$
|
System.out.println(UIMessages.getString("CMainWizardPage.5") + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (w == null) return null;
|
if (w == null) return null;
|
||||||
|
|
||||||
w.setDependentControl(right, ls);
|
w.setDependentControl(right, ls);
|
||||||
w.createItems(tree, show_sup.getSelection());
|
WizardItemData[] wd = w.createItems(show_sup.getSelection(), wizard);
|
||||||
|
for (int x=0; x<wd.length; x++) items.add(wd[x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addItemsToTree(tree, items);
|
||||||
|
|
||||||
if (tree.getItemCount() > 0) {
|
if (tree.getItemCount() > 0) {
|
||||||
TreeItem target = tree.getItem(0);
|
TreeItem target = tree.getItem(0);
|
||||||
// try to search item which was selected before
|
// try to search item which was selected before
|
||||||
|
@ -439,40 +442,72 @@ import org.eclipse.ui.PlatformUI;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void addItemsToTree(Tree tree, ArrayList items) {
|
||||||
|
ArrayList tis = new ArrayList(items.size());
|
||||||
|
ArrayList its = new ArrayList(items.size());
|
||||||
|
Iterator it = items.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
WizardItemData wd = (WizardItemData)it.next();
|
||||||
|
if (wd.parentId == null) {
|
||||||
|
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
||||||
|
ti.setText(wd.name);
|
||||||
|
ti.setData(wd.handler);
|
||||||
|
if (wd.image != null)ti.setImage(wd.image);
|
||||||
|
tis.add(ti);
|
||||||
|
its.add(wd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(true) {
|
||||||
|
boolean found = false;
|
||||||
|
Iterator it2 = items.iterator();
|
||||||
|
while (it2.hasNext()) {
|
||||||
|
WizardItemData wd1 = (WizardItemData)it2.next();
|
||||||
|
if (wd1.parentId == null) continue;
|
||||||
|
for (int i=0; i<its.size(); i++) {
|
||||||
|
WizardItemData wd2 = (WizardItemData)its.get(i);
|
||||||
|
if (wd2.id.equals(wd1.parentId)) {
|
||||||
|
found = true;
|
||||||
|
TreeItem p = (TreeItem)tis.get(i);
|
||||||
|
TreeItem ti = new TreeItem(p, SWT.NONE);
|
||||||
|
ti.setText(wd1.name);
|
||||||
|
ti.setData(wd1.handler);
|
||||||
|
if (wd1.image != null)ti.setImage(wd1.image);
|
||||||
|
tis.add(ti);
|
||||||
|
its.add(wd1);
|
||||||
|
wd1.parentId = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// repeat iterations until all items are placed.
|
||||||
|
if (!found) break;
|
||||||
|
}
|
||||||
|
// show orphan elements, if any
|
||||||
|
Iterator it3 = items.iterator();
|
||||||
|
while (it3.hasNext()) {
|
||||||
|
WizardItemData wd = (WizardItemData)it3.next();
|
||||||
|
if (wd.parentId == null) continue;
|
||||||
|
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
||||||
|
ti.setText(wd.name + " @ " + wd.parentId); //$NON-NLS-1$
|
||||||
|
ti.setData(wd.handler);
|
||||||
|
if (wd.image != null)ti.setImage(wd.image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param h - new handler
|
* @param h - new handler
|
||||||
*/
|
*/
|
||||||
private void switchTo(ICWizardHandler h) {
|
private void switchTo(ICWizardHandler h) {
|
||||||
if (h == null) return;
|
|
||||||
if (h_selected != null) h_selected.handleUnSelection();
|
if (h_selected != null) h_selected.handleUnSelection();
|
||||||
h_selected = h;
|
h_selected = h;
|
||||||
|
if (h == null) return;
|
||||||
right_label.setText(h_selected.getHeader());
|
right_label.setText(h_selected.getHeader());
|
||||||
h_selected.handleSelection();
|
h_selected.handleSelection();
|
||||||
next.setHandler(h_selected);
|
|
||||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
setCustomPagesFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCustomPagesFilter() {
|
|
||||||
// Set up Manager's filters
|
|
||||||
if (h_selected.getProjectType() != null) {
|
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.PROJECT_TYPE, h_selected.getProjectType().getId());
|
|
||||||
} else {
|
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.PROJECT_TYPE, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
IToolChain[] tcs = h_selected.getSelectedToolChains();
|
|
||||||
int n = (tcs == null) ? 0 : tcs.length;
|
|
||||||
Set x = new TreeSet();
|
|
||||||
for (int i=0; i<n; i++) {
|
|
||||||
x.add(tcs[i]);
|
|
||||||
}
|
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.TOOLCHAIN, x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toolChainListChanged(int count) {
|
public void toolChainListChanged(int count) {
|
||||||
if ( !h_selected.canCreateWithoutToolchain())
|
setPageComplete(validatePage());
|
||||||
setPageComplete(validatePage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCurrent() { return isCurrentPage(); }
|
public boolean isCurrent() { return isCurrentPage(); }
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 Intel Corporation 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:
|
||||||
|
* Intel Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is basic implementation for ICWizardHandler interface.
|
||||||
|
* It is independent of managed build system, and, so, almost useless
|
||||||
|
* It creates "empty" project with no specific.
|
||||||
|
*
|
||||||
|
* Its descendants should overwrite some methods,
|
||||||
|
* including createProject() and handleSelection()
|
||||||
|
*
|
||||||
|
* This object is created per each Project type
|
||||||
|
* on the left pane of New Project Wizard page
|
||||||
|
*
|
||||||
|
* It is responsible for:
|
||||||
|
* - corresponding line in left pane of 1st wizard page
|
||||||
|
* - whole view of right pane
|
||||||
|
* - processing preferred items, if any.
|
||||||
|
* - providing data for ConfigPage
|
||||||
|
* - processing data received from config page
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CWizardHandler implements ICWizardHandler {
|
||||||
|
protected static final Image IMG0 = CPluginImages.get(CPluginImages.IMG_EMPTY);
|
||||||
|
protected static final Image IMG1 = CPluginImages.get(CPluginImages.IMG_PREFERRED);
|
||||||
|
|
||||||
|
protected String head;
|
||||||
|
protected String name;
|
||||||
|
protected Image image;
|
||||||
|
protected Composite parent;
|
||||||
|
protected Table table;
|
||||||
|
protected boolean supportedOnly = true;
|
||||||
|
|
||||||
|
public CWizardHandler(Composite _parent, String _head, String _name, Image _image) {
|
||||||
|
parent = _parent;
|
||||||
|
name = _name;
|
||||||
|
image = _image;
|
||||||
|
head = _head;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSelection() {
|
||||||
|
List preferred = CDTPrefUtil.getPreferredTCs();
|
||||||
|
if (table == null) {
|
||||||
|
table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
|
||||||
|
TableItem ti = new TableItem(table, SWT.NONE);
|
||||||
|
ti.setText("Single item"); //$NON-NLS-1$
|
||||||
|
ti.setImage(IMG0);
|
||||||
|
table.select(0);
|
||||||
|
}
|
||||||
|
updatePreferred(preferred);
|
||||||
|
table.setVisible(true);
|
||||||
|
parent.layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleUnSelection() {
|
||||||
|
if (table != null) {
|
||||||
|
table.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeader() { return head; }
|
||||||
|
public String getName() { return name; }
|
||||||
|
public Image getIcon() { return image; }
|
||||||
|
public String getErrorMessage() { return null; }
|
||||||
|
|
||||||
|
public void setSupportedOnly(boolean supp) { supportedOnly = supp;}
|
||||||
|
public boolean supportedOnly() { return supportedOnly; }
|
||||||
|
public boolean supportsPreferred() { return false; }
|
||||||
|
public IWizardPage getSpecificPage() { return null; }
|
||||||
|
public void updatePreferred(List prefs) {}
|
||||||
|
|
||||||
|
public void createProject(IProject proj, boolean defaults)
|
||||||
|
throws CoreException {}
|
||||||
|
public boolean isChanged() { return true; }
|
||||||
|
public void saveState() {}
|
||||||
|
|
||||||
|
}
|
|
@ -8,10 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to be used by extension point:
|
* Interface to be used by extension point:
|
||||||
|
@ -29,10 +30,10 @@ public interface ICNewWizard {
|
||||||
* each of them should have data object attached,
|
* each of them should have data object attached,
|
||||||
* data should be lt;ICProjectTypeHandler>
|
* data should be lt;ICProjectTypeHandler>
|
||||||
*
|
*
|
||||||
* @param tree - parent tree object
|
|
||||||
* @param supportedOnly - whether display supported types only
|
* @param supportedOnly - whether display supported types only
|
||||||
|
* @param wizard - New Project wizard to be passed to ICWizardHandler
|
||||||
*/
|
*/
|
||||||
void createItems(Tree tree, boolean supportedOnly);
|
public WizardItemData[] createItems(boolean supportedOnly, IWizard wizard);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementor will be informed about widget where additional
|
* Implementor will be informed about widget where additional
|
||||||
|
@ -45,5 +46,5 @@ public interface ICNewWizard {
|
||||||
* May be null if notification is not required
|
* May be null if notification is not required
|
||||||
* or implementor does not really support it.
|
* or implementor does not really support it.
|
||||||
*/
|
*/
|
||||||
void setDependentControl(Composite parent, IToolChainListListener page);
|
public void setDependentControl(Composite parent, IWizardItemsListListener page);
|
||||||
}
|
}
|
|
@ -8,31 +8,52 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
|
|
||||||
public interface ICWizardHandler {
|
public interface ICWizardHandler {
|
||||||
static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$
|
static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$
|
||||||
|
|
||||||
void handleSelection();
|
/**
|
||||||
void handleUnSelection();
|
* Called when user selects corresponding item in wizard tree
|
||||||
String getName();
|
*
|
||||||
Image getIcon();
|
* @parame pane - parent for handler-specific data
|
||||||
String getHeader();
|
*/
|
||||||
void createProject(IProject proj, CfgHolder[] cfgs) throws CoreException;
|
public void handleSelection();
|
||||||
boolean isDummy();
|
/**
|
||||||
public IToolChain[] getSelectedToolChains();
|
* Called when user leaves corresponding item in wizard tree
|
||||||
public int getToolChainsCount();
|
*/
|
||||||
public IProjectType getProjectType();
|
public void handleUnSelection();
|
||||||
public String getPropertyId();
|
/**
|
||||||
|
* @return label of tree item
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
|
/**
|
||||||
|
* @return icon for tree item
|
||||||
|
*/
|
||||||
|
public Image getIcon();
|
||||||
|
/**
|
||||||
|
* @return text for label above handler-specific pane
|
||||||
|
*/
|
||||||
|
public String getHeader();
|
||||||
|
/**
|
||||||
|
* @return 1st handler-specific page
|
||||||
|
*/
|
||||||
|
public IWizardPage getSpecificPage();
|
||||||
|
/**
|
||||||
|
* Creates project
|
||||||
|
*
|
||||||
|
* @param proj - simple project to be used as base
|
||||||
|
* @param defaults - true if called from 1st Wizard page
|
||||||
|
* @throws CoreException
|
||||||
|
*/
|
||||||
|
public void createProject(IProject proj, boolean defaults) throws CoreException;
|
||||||
/**
|
/**
|
||||||
* @return true if only supported project types and toolchains are displayed
|
* @return true if only supported project types and toolchains are displayed
|
||||||
*/
|
*/
|
||||||
|
@ -42,10 +63,6 @@ public interface ICWizardHandler {
|
||||||
* @param supp
|
* @param supp
|
||||||
*/
|
*/
|
||||||
public void setSupportedOnly(boolean supp);
|
public void setSupportedOnly(boolean supp);
|
||||||
/**
|
|
||||||
* @return true if project can be created with zero toolchains selected
|
|
||||||
*/
|
|
||||||
public boolean canCreateWithoutToolchain();
|
|
||||||
/**
|
/**
|
||||||
* @return true if handler is able to process preferred toolchains
|
* @return true if handler is able to process preferred toolchains
|
||||||
*/
|
*/
|
||||||
|
@ -56,5 +73,19 @@ public interface ICWizardHandler {
|
||||||
* @param prefs - list of strings (preferred Toolchain IDs)
|
* @param prefs - list of strings (preferred Toolchain IDs)
|
||||||
*/
|
*/
|
||||||
public void updatePreferred(List prefs);
|
public void updatePreferred(List prefs);
|
||||||
|
/**
|
||||||
|
* @return null if data is consistent
|
||||||
|
* else returns error message
|
||||||
|
*/
|
||||||
|
public String getErrorMessage();
|
||||||
|
/**
|
||||||
|
* Stores current internal settings
|
||||||
|
*/
|
||||||
|
public void saveState();
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true if settings were changed
|
||||||
|
* since last call to saveState()
|
||||||
|
*/
|
||||||
|
public boolean isChanged();
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface should be implemented by some visible object
|
* Interface should be implemented by some visible object
|
||||||
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
* to be informed about changes in tool chains selection
|
* to be informed about changes in tool chains selection
|
||||||
* performed by ICNewWizard implementors.
|
* performed by ICNewWizard implementors.
|
||||||
*/
|
*/
|
||||||
public interface IToolChainListListener {
|
public interface IWizardItemsListListener {
|
||||||
/**
|
/**
|
||||||
* Called by ICNewWizard instance when
|
* Called by ICNewWizard instance when
|
||||||
* user has changed tool chains selection
|
* user has changed tool chains selection
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 Intel Corporation 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:
|
||||||
|
* Intel Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
|
||||||
|
public interface IWizardWithMemory extends IWizard {
|
||||||
|
// returns name of last-created project
|
||||||
|
// or null if no projects were created
|
||||||
|
public String getLastProjectName();
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 Intel Corporation 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:
|
||||||
|
* Intel Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class stores data for each tree item
|
||||||
|
* in "Project types" tree of New Project Wizard.
|
||||||
|
*/
|
||||||
|
public class WizardItemData {
|
||||||
|
public String id = null;
|
||||||
|
public String parentId = null;
|
||||||
|
public String name = null;
|
||||||
|
public Image image = null;
|
||||||
|
public ICWizardHandler handler = null;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue