mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +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="DiscoveryProfileUI" name="DiscoveryProfileUI" schema="schema/DiscoveryProfileUI.exsd"/>
|
||||
<extension-point id="CDTWizard" name="CDTWizard" schema="schema/CDTWizard.exsd"/>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.newWizards">
|
||||
|
@ -413,7 +412,7 @@
|
|||
<extension
|
||||
id="BuildSystemWizard"
|
||||
name="%Build.System.Wizard"
|
||||
point="org.eclipse.cdt.managedbuilder.ui.CDTWizard">
|
||||
point="org.eclipse.cdt.ui.CDTWizard">
|
||||
<wizard
|
||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.CNewWizard"
|
||||
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.ui.properties.AbstractCBuildPropertyTab;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.PageLayout;
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.CMainWizardPage;
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.ICWizardHandler;
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.ICBuildWizardHandler;
|
||||
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.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -101,20 +102,22 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
|||
public void widgetSelected(SelectionEvent e) {
|
||||
if (h_selected != null)
|
||||
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();
|
||||
switchTo(CMainWizardPage.updateData(tree, right, show_sup, null));
|
||||
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null));
|
||||
}
|
||||
|
||||
private void setPref(boolean set) {
|
||||
if (h_selected == null || !h_selected.supportsPreferred())
|
||||
return;
|
||||
IToolChain[] tcs = h_selected.getSelectedToolChains();
|
||||
for (int i=0; i<tcs.length; i++) {
|
||||
String id = (tcs[i] == null) ? CDTPrefUtil.NULL : tcs[i].getId();
|
||||
if (set) CDTPrefUtil.addPreferredTC(id);
|
||||
else CDTPrefUtil.delPreferredTC(id);
|
||||
if (h_selected instanceof ICBuildWizardHandler) {
|
||||
IToolChain[] tcs = ((ICBuildWizardHandler)h_selected).getSelectedToolChains();
|
||||
for (int i=0; i<tcs.length; i++) {
|
||||
String id = (tcs[i] == null) ? CDTPrefUtil.NULL : tcs[i].getId();
|
||||
if (set) CDTPrefUtil.addPreferredTC(id);
|
||||
else CDTPrefUtil.delPreferredTC(id);
|
||||
}
|
||||
}
|
||||
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
|
||||
}
|
||||
|
|
|
@ -80,12 +80,7 @@ public class ManagedBuilderUIImages {
|
|||
public static final ImageDescriptor DESC_EDITABLE = createManaged(T_OBJ, IMG_EDITABLE);
|
||||
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 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) {
|
||||
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.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
||||
import org.eclipse.cdt.ui.newui.PageLayout;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.preference.IPreferencePageContainer;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
|
|
@ -76,29 +76,6 @@ PreferredToolchainsTab.2=Make toolhain(s) unpreferred
|
|||
StdProjectTypeHandler.0=-- Other Toolchain --
|
||||
StdProjectTypeHandler.2=Default
|
||||
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_projectNameEmpty=
|
||||
WizardNewProjectCreationPage_projectExistsMessage=
|
||||
|
@ -117,14 +94,4 @@ NewModelProjectWizard.3=Create C++ project of selected type
|
|||
NewModelProjectWizard.4=C project
|
||||
NewModelProjectWizard.5=Create C project of selected type
|
||||
StdBuildWizard.0=Makefile project
|
||||
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
|
||||
MBSWizardHandler.0=At least one toolchain should be selected
|
||||
|
|
|
@ -16,6 +16,8 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
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.swt.graphics.Image;
|
||||
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 Composite parent;
|
||||
protected IToolChainListListener listener;
|
||||
protected IWizardItemsListListener listener;
|
||||
|
||||
public void setDependentControl(Composite _parent, IToolChainListListener _listener) {
|
||||
public void setDependentControl(Composite _parent, IWizardItemsListListener _listener) {
|
||||
parent = _parent;
|
||||
listener = _listener;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
||||
public class CCProjectWizard extends NewModelProjectWizard {
|
||||
public class CCProjectWizard extends MBSProjectWizard {
|
||||
|
||||
public CCProjectWizard() {
|
||||
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;
|
||||
|
||||
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.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
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.UIMessages;
|
||||
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
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.LabelProvider;
|
||||
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.events.SelectionAdapter;
|
||||
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.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$
|
||||
|
||||
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 MESSAGE = Messages.getString("CConfigWizardPage.1"); //$NON-NLS-1$
|
||||
private static final String COMMENT = Messages.getString("CConfigWizardPage.12"); //$NON-NLS-1$
|
||||
private static final String TITLE = UIMessages.getString("CConfigWizardPage.0"); //$NON-NLS-1$
|
||||
private static final String MESSAGE = UIMessages.getString("CConfigWizardPage.1"); //$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 ICWizardHandler handler;
|
||||
private Table table;
|
||||
private CheckboxTableViewer tv;
|
||||
private Label l_projtype;
|
||||
|
@ -62,12 +68,45 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
private String propertyId;
|
||||
private String errorMessage = null;
|
||||
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) {
|
||||
if (handler == null) return null;
|
||||
CfgHolder[] its;
|
||||
if (getDefault)
|
||||
its = getDefaultCfgs(handler);
|
||||
|
@ -88,11 +127,11 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
parent.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||
|
@ -109,13 +148,13 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
});
|
||||
tv.setLabelProvider(new LabelProvider() {
|
||||
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; }
|
||||
});
|
||||
tv.addCheckStateListener(new ICheckStateListener() {
|
||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||
isCustomPageComplete();
|
||||
setPageComplete(isCustomPageComplete());
|
||||
update();
|
||||
}});
|
||||
Composite c = new Composite(parent, SWT.NONE);
|
||||
|
@ -123,22 +162,22 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
c.setLayout(new GridLayout(1, false));
|
||||
|
||||
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.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
tv.setAllChecked(true);
|
||||
isCustomPageComplete();
|
||||
setPageComplete(isCustomPageComplete());
|
||||
update();
|
||||
}});
|
||||
|
||||
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.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
tv.setAllChecked(false);
|
||||
isCustomPageComplete();
|
||||
setPageComplete(isCustomPageComplete());
|
||||
update();
|
||||
}});
|
||||
|
||||
|
@ -146,7 +185,7 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
new Label(c, 0).setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
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.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -167,7 +206,7 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
* @param handler
|
||||
* @return
|
||||
*/
|
||||
static public CfgHolder[] getDefaultCfgs(ICWizardHandler handler) {
|
||||
static public CfgHolder[] getDefaultCfgs(MBSWizardHandler handler) {
|
||||
IToolChain[] tcs = handler.getSelectedToolChains();
|
||||
String id = handler.getPropertyId();
|
||||
IProjectType pt = handler.getProjectType();
|
||||
|
@ -203,12 +242,12 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
if (!isVisible) return true;
|
||||
|
||||
if (table.getItemCount() == 0) {
|
||||
errorMessage = Messages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
|
||||
errorMessage = UIMessages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
|
||||
message = errorMessage;
|
||||
return false;
|
||||
}
|
||||
if (tv.getCheckedElements().length == 0) {
|
||||
errorMessage = Messages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
|
||||
errorMessage = UIMessages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
|
||||
message = errorMessage;
|
||||
return false;
|
||||
}
|
||||
|
@ -222,19 +261,20 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
isVisible = visible;
|
||||
if (visible && handler != null) {
|
||||
if (visible && handler != null) {
|
||||
tv.setInput(CfgHolder.unique(getDefaultCfgs(handler)));
|
||||
tv.setAllChecked(true);
|
||||
String s = EMPTY_STR;
|
||||
IToolChain[] tc = handler.getSelectedToolChains();
|
||||
for (int i=0; i < tc.length; i++) {
|
||||
s = s + ((tc[i] == null) ?
|
||||
Messages.getString("StdProjectTypeHandler.0") : //$NON-NLS-1$
|
||||
"" : //$NON-NLS-1$
|
||||
tc[i].getName());
|
||||
if (i < tc.length - 1) s = s + ", "; //$NON-NLS-1$
|
||||
}
|
||||
l_chains.setText(s);
|
||||
l_projtype.setText(handler.getName());
|
||||
l_projtype.setText(handler.getName());
|
||||
setPageComplete(isCustomPageComplete());
|
||||
}
|
||||
parent.setVisible(visible);
|
||||
if (visible) update();
|
||||
|
@ -252,14 +292,12 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
return l;
|
||||
}
|
||||
|
||||
public void setHandler(ICWizardHandler h) { handler = h; }
|
||||
|
||||
public String getName() { return TITLE; }
|
||||
public void dispose() {}
|
||||
public Control getControl() { return parent; }
|
||||
public String getDescription() { return null; }
|
||||
public String getErrorMessage() { return errorMessage; }
|
||||
public Image getImage() { return wizard.getDefaultPageImage(); }
|
||||
// public Image getImage() { return wizard.getDefaultPageImage(); }
|
||||
public String getMessage() { return message; }
|
||||
public String getTitle() { return TITLE; }
|
||||
public void performHelp() {}
|
||||
|
@ -268,24 +306,24 @@ public class CConfigWizardPage extends MBSCustomPage {
|
|||
public void setTitle(String _title) {}
|
||||
|
||||
protected void update() {
|
||||
wizard.getContainer().updateButtons();
|
||||
wizard.getContainer().updateMessage();
|
||||
wizard.getContainer().updateTitleBar();
|
||||
getWizard().getContainer().updateButtons();
|
||||
getWizard().getContainer().updateMessage();
|
||||
getWizard().getContainer().updateTitleBar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit properties
|
||||
*/
|
||||
private void advancedDialog() {
|
||||
if (wizard instanceof NewModelProjectWizard) {
|
||||
NewModelProjectWizard nmWizard = (NewModelProjectWizard)wizard;
|
||||
if (getWizard() instanceof MBSProjectWizard) {
|
||||
MBSProjectWizard nmWizard = (MBSProjectWizard)getWizard();
|
||||
IProject newProject = nmWizard.getProject(true);
|
||||
if (newProject != null) {
|
||||
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG);
|
||||
// disable manage configurations button
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, true);
|
||||
try {
|
||||
PreferencesUtil.createPropertyDialogOn(wizard.getContainer().getShell(), newProject, propertyId, null, null).open();
|
||||
PreferencesUtil.createPropertyDialogOn(getWizard().getContainer().getShell(), newProject, propertyId, null, null).open();
|
||||
} finally {
|
||||
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.core.resources.IProject;
|
||||
|
||||
public class CDTProjectWizard extends NewModelProjectWizard {
|
||||
public class CDTProjectWizard extends MBSProjectWizard {
|
||||
|
||||
public CDTProjectWizard() {
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
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.ui.properties.Messages;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||
import org.eclipse.cdt.ui.wizards.WizardItemData;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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();
|
||||
IBuildPropertyType bpt = bpm.getPropertyType(ICWizardHandler.ARTIFACT);
|
||||
IBuildPropertyValue[] vs = bpt.getSupportedValues();
|
||||
|
||||
|
||||
ArrayList items = new ArrayList();
|
||||
// new style project types
|
||||
for (int i=0; i<vs.length; i++) {
|
||||
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(ICWizardHandler.ARTIFACT, vs[i].getId());
|
||||
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++) {
|
||||
if (!supportedOnly || isValid(tcs[j])) h.addTc(tcs[j]);
|
||||
}
|
||||
if (h.getToolChainsCount() > 0) {
|
||||
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
||||
ti.setText(h.getName());
|
||||
ti.setData(h);
|
||||
ti.setImage(h.getIcon());
|
||||
WizardItemData wd = new WizardItemData();
|
||||
wd.name = h.getName();
|
||||
wd.handler = h;
|
||||
wd.image = h.getIcon();
|
||||
wd.id = h.getName();
|
||||
wd.parentId = null;
|
||||
items.add(wd);
|
||||
}
|
||||
}
|
||||
|
||||
// old style project types
|
||||
TreeItem oldsRoot = null;
|
||||
WizardItemData oldsRoot = null;
|
||||
SortedMap sm = ManagedBuildManager.getExtensionProjectTypeMap();
|
||||
Iterator it = sm.keySet().iterator();
|
||||
while(it.hasNext()) {
|
||||
|
@ -65,7 +70,7 @@ public class CNewWizard extends AbstractCWizard {
|
|||
if (supportedOnly && !pt.isSupported()) continue; // not supported
|
||||
String nattr = pt.getNameAttribute();
|
||||
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();
|
||||
if (cfgs == null || cfgs.length == 0) continue;
|
||||
IToolChain tc = null;
|
||||
|
@ -80,21 +85,27 @@ public class CNewWizard extends AbstractCWizard {
|
|||
if (tc == null) continue;
|
||||
h.addTc(tc);
|
||||
|
||||
TreeItem ti = null;
|
||||
WizardItemData wd = new WizardItemData();
|
||||
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS)) {
|
||||
if (oldsRoot == null) {
|
||||
oldsRoot = new TreeItem(tree, SWT.NONE);
|
||||
oldsRoot.setText(Messages.getString("CNewWizard.0")); //$NON-NLS-1$
|
||||
oldsRoot.setData(new DummyHandler(parent));
|
||||
oldsRoot.setImage(IMG0);
|
||||
oldsRoot = new WizardItemData();
|
||||
oldsRoot.name = Messages.getString("CNewWizard.0"); //$NON-NLS-1$
|
||||
oldsRoot.handler = null;
|
||||
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>
|
||||
ti = new TreeItem(tree, SWT.NONE);
|
||||
wd.parentId = null;
|
||||
}
|
||||
ti.setText(h.getName());
|
||||
ti.setData(h);
|
||||
ti.setImage(h.getIcon());
|
||||
wd.name = h.getName();
|
||||
wd.handler = h;
|
||||
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.NullProgressMonitor;
|
||||
|
||||
public class CProjectWizard extends NewModelProjectWizard {
|
||||
public class CProjectWizard extends MBSProjectWizard {
|
||||
|
||||
public CProjectWizard() {
|
||||
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.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||
|
||||
/*
|
||||
* This class is intended for data exchange between
|
||||
|
@ -25,16 +25,16 @@ import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|||
public class CfgHolder {
|
||||
private static final String DELIMITER = "_with_"; //$NON-NLS-1$
|
||||
|
||||
String name;
|
||||
IConfiguration cfg;
|
||||
IToolChain tc;
|
||||
private String name;
|
||||
private IConfiguration cfg;
|
||||
private IToolChain tc;
|
||||
|
||||
public CfgHolder(IToolChain _tc, IConfiguration _cfg) {
|
||||
tc = _tc;
|
||||
cfg = _cfg;
|
||||
if (cfg == null) {
|
||||
if (tc == null)
|
||||
name = Messages.getString("StdProjectTypeHandler.2"); //$NON-NLS-1$
|
||||
name = UIMessages.getString("StdProjectTypeHandler.2"); //$NON-NLS-1$
|
||||
else
|
||||
name = tc.getName();
|
||||
} else
|
||||
|
@ -94,4 +94,7 @@ public class CfgHolder {
|
|||
if (its[i].cfg != null) lst.add(its[i].cfg);
|
||||
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();
|
||||
|
||||
// if no toolchains are specified then we're done
|
||||
if (toolchainData == null)
|
||||
if (toolchainData == null || toolchainSet == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -353,7 +353,6 @@ public final class MBSCustomPageManager
|
|||
// otherwise, iterate through the toolchains to see if one matches
|
||||
for (int k = 0; k < toolchainData.length; k++)
|
||||
{
|
||||
|
||||
// check all toolchains, see if there is one for which we should be present
|
||||
Iterator toolchainIterator = toolchainSet.iterator();
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Intel corp - rework for New Project Model
|
||||
*******************************************************************************/
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
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.Messages;
|
||||
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.IProjectDescription;
|
||||
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.NullProgressMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
||||
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 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$
|
||||
|
||||
protected IConfigurationElement fConfigElement;
|
||||
protected CMainWizardPage fMainPage;
|
||||
protected CConfigWizardPage fConfigPage;
|
||||
protected CDTMainWizardPage fMainPage;
|
||||
|
||||
protected IProject newProject;
|
||||
private String wz_title;
|
||||
|
@ -63,16 +62,15 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
|||
|
||||
public String lastProjectName = null;
|
||||
private ICWizardHandler savedHandler = null;
|
||||
private IToolChain[] savedToolChains = null;
|
||||
private boolean savedDefaults = false;
|
||||
|
||||
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$
|
||||
}
|
||||
|
||||
public NewModelProjectWizard(String title, String desc) {
|
||||
public MBSProjectWizard(String title, String desc) {
|
||||
super();
|
||||
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
|
||||
setNeedsProgressMonitor(true);
|
||||
|
@ -81,62 +79,22 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
|||
}
|
||||
|
||||
public void addPages() {
|
||||
fConfigPage = new CConfigWizardPage();
|
||||
fMainPage= new CMainWizardPage(CUIPlugin.getResourceString(PREFIX), fConfigPage);
|
||||
fMainPage= new CDTMainWizardPage(CUIPlugin.getResourceString(PREFIX));
|
||||
fMainPage.setTitle(wz_title);
|
||||
fMainPage.setDescription(wz_desc);
|
||||
addPage(fMainPage);
|
||||
addPage(fConfigPage);
|
||||
|
||||
// support for custom wizard pages
|
||||
MBSCustomPageManager.init();
|
||||
MBSCustomPageManager.addStockPage(fMainPage, CMainWizardPage.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]);
|
||||
}
|
||||
}
|
||||
MBSCustomPageManager.addStockPage(fMainPage, CDTMainWizardPage.PAGE_ID);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return true if user has changed settings since project creation
|
||||
*/
|
||||
private boolean isChanged() {
|
||||
if (savedHandler != fMainPage.h_selected || !fMainPage.getProjectName().equals(lastProjectName))
|
||||
return true;
|
||||
IToolChain[] tcs = fMainPage.h_selected.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;
|
||||
return savedHandler.isChanged();
|
||||
}
|
||||
|
||||
public IProject getProject(boolean defaults) {
|
||||
|
@ -145,7 +103,7 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
|||
if (newProject == null) {
|
||||
savedDefaults = defaults;
|
||||
savedHandler = fMainPage.h_selected;
|
||||
savedToolChains = fMainPage.h_selected.getSelectedToolChains();
|
||||
savedHandler.saveState();
|
||||
lastProjectName = fMainPage.getProjectName();
|
||||
// start creation process
|
||||
invokeRunnable(getRunnable(defaults));
|
||||
|
@ -203,19 +161,20 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void deleteExtraConfigs() {
|
||||
if (fMainPage.isCurrent()) return; // nothing to delete
|
||||
if (!(fMainPage.h_selected instanceof MBSWizardHandler))
|
||||
return;
|
||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(newProject, true);
|
||||
if (prjd == null) return;
|
||||
ICConfigurationDescription[] all = prjd.getConfigurations();
|
||||
if (all == null) return;
|
||||
CfgHolder[] req = fConfigPage.getCfgItems(false);
|
||||
CfgHolder[] req = ((MBSWizardHandler)fMainPage.h_selected).getCfgItems(false);
|
||||
boolean modified = false;
|
||||
for (int i=0; i<all.length; i++) {
|
||||
boolean found = false;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +187,7 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
|||
CoreModel.getDefault().setProjectDescription(newProject, prjd);
|
||||
} catch (CoreException e) {}
|
||||
}
|
||||
|
||||
|
||||
private void doCustom() {
|
||||
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
|
||||
if(operations != null)
|
||||
|
@ -255,7 +214,7 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
|
|||
try {
|
||||
newProject = createIProject(lastProjectName, fMainPage.getProjectLocation());
|
||||
if (newProject != null)
|
||||
fMainPage.h_selected.createProject(newProject, fConfigPage.getCfgItems(defaults));
|
||||
fMainPage.h_selected.createProject(newProject, defaults);
|
||||
} 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 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.ManagedBuildInfo;
|
||||
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.Messages;
|
||||
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.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
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.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -53,47 +57,36 @@ import org.eclipse.swt.widgets.TableItem;
|
|||
* - whole view of right pane, including
|
||||
*
|
||||
*/
|
||||
public class CWizardHandler implements ICWizardHandler {
|
||||
private static final Image IMG0 = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_EMPTY);
|
||||
private static final Image IMG1 = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_PREFERRED);
|
||||
public class MBSWizardHandler extends CWizardHandler implements ICBuildWizardHandler {
|
||||
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 head = Messages.getString("CWizardHandler.0"); //$NON-NLS-1$
|
||||
private static final String tooltip =
|
||||
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.4") + //$NON-NLS-1$
|
||||
Messages.getString("CWizardHandler.5"); //$NON-NLS-1$
|
||||
|
||||
protected SortedMap tcs;
|
||||
private String name;
|
||||
private Image image;
|
||||
private Composite parent;
|
||||
protected Table table;
|
||||
protected SortedMap tcs = new TreeMap();
|
||||
private String propertyId = null;
|
||||
private IProjectType pt = null;
|
||||
private IToolChainListListener listener;
|
||||
private boolean supportedOnly = true;
|
||||
protected IWizardItemsListListener listener;
|
||||
protected CDTConfigWizardPage fConfigPage;
|
||||
private IToolChain[] savedToolChains = null;
|
||||
private IWizard wizard;
|
||||
|
||||
public CWizardHandler(String _name, IProjectType _pt, Image _image, Composite p, IToolChainListListener _listener) {
|
||||
tcs = new TreeMap();
|
||||
name = _name;
|
||||
image = _image;
|
||||
parent = p;
|
||||
public MBSWizardHandler(String _name, IProjectType _pt, Image _image, Composite p, IWizardItemsListListener _listener, IWizard w) {
|
||||
super(p, Messages.getString("CWizardHandler.0"), _name, _image); //$NON-NLS-1$
|
||||
pt = _pt;
|
||||
listener = _listener;
|
||||
wizard = w;
|
||||
}
|
||||
|
||||
public CWizardHandler(IBuildPropertyValue val, Image _image, Composite p, IToolChainListListener _listener) {
|
||||
tcs = new TreeMap();
|
||||
name = val.getName();
|
||||
public MBSWizardHandler(IBuildPropertyValue val, Image _image, Composite p, IWizardItemsListListener _listener, IWizard w) {
|
||||
super(p, Messages.getString("CWizardHandler.0"), val.getName(), _image); //$NON-NLS-1$
|
||||
propertyId = val.getId();
|
||||
image = _image;
|
||||
parent = p;
|
||||
listener = _listener;
|
||||
wizard = w;
|
||||
}
|
||||
|
||||
public void handleSelection() {
|
||||
|
@ -134,12 +127,14 @@ public class CWizardHandler implements ICWizardHandler {
|
|||
updatePreferred(preferred);
|
||||
table.setVisible(true);
|
||||
parent.layout();
|
||||
if (fConfigPage != null) fConfigPage.pagesLoaded = false;
|
||||
}
|
||||
|
||||
public void handleUnSelection() {
|
||||
if (table != null) {
|
||||
table.setVisible(false);
|
||||
}
|
||||
if (fConfigPage != null) fConfigPage.pagesLoaded = false;
|
||||
}
|
||||
|
||||
public void addTc(IToolChain tc) {
|
||||
|
@ -156,35 +151,22 @@ public class CWizardHandler implements ICWizardHandler {
|
|||
tcs.put(tc.getUniqueRealName(), tc);
|
||||
}
|
||||
|
||||
public IToolChain[] getSelectedToolChains() {
|
||||
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 {
|
||||
public void createProject(IProject project, boolean defaults) throws CoreException {
|
||||
CoreModel coreModel = CoreModel.getDefault();
|
||||
// ICProjectDescription des = coreModel.getProjectDescription(project);
|
||||
// des = coreModel.createProjectDescription(project, true);
|
||||
CfgHolder[] cfgs = fConfigPage.getCfgItems(defaults);
|
||||
ICProjectDescription des = coreModel.createProjectDescription(project, false);
|
||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||
|
||||
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,
|
||||
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
||||
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
ManagedProject mProj = new ManagedProject(project, cfgs[0].cfg.getProjectType());
|
||||
Configuration cf = (Configuration)cfgs[0].getConfiguration();
|
||||
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
|
||||
info.setManagedProject(mProj);
|
||||
|
||||
cfgs = CfgHolder.unique(cfgs);
|
||||
|
@ -192,8 +174,9 @@ public class CWizardHandler implements ICWizardHandler {
|
|||
ICConfigurationDescription active = null;
|
||||
|
||||
for(int i = 0; i < cfgs.length; i++){
|
||||
String id = ManagedBuildManager.calculateChildId(cfgs[i].cfg.getId(), null);
|
||||
Configuration config = new Configuration(mProj, (Configuration)cfgs[i].cfg, id, false, true);
|
||||
cf = (Configuration)cfgs[i].getConfiguration();
|
||||
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
|
||||
Configuration config = new Configuration(mProj, cf, id, false, true);
|
||||
CConfigurationData data = config.getConfigurationData();
|
||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||
config.setConfigurationDescription(cfgDes);
|
||||
|
@ -203,7 +186,7 @@ public class CWizardHandler implements ICWizardHandler {
|
|||
if (bld != null) { bld.setManagedBuildOn(true); }
|
||||
|
||||
String s = project.getName();
|
||||
config.setName(cfgs[i].name);
|
||||
config.setName(cfgs[i].getName());
|
||||
config.setArtifactName(s);
|
||||
|
||||
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
||||
|
@ -216,21 +199,13 @@ public class CWizardHandler implements ICWizardHandler {
|
|||
coreModel.setProjectDescription(project, des);
|
||||
}
|
||||
|
||||
// interface methods
|
||||
public IWizardPage getSpecificPage() {
|
||||
if (fConfigPage == null) {
|
||||
fConfigPage = new CDTConfigWizardPage(this);
|
||||
}
|
||||
return fConfigPage;
|
||||
}
|
||||
|
||||
public String getHeader() { return head; }
|
||||
public String getName() { return name; }
|
||||
public Image getIcon() { return image; }
|
||||
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
|
||||
*/
|
||||
|
@ -243,4 +218,66 @@ public class CWizardHandler implements ICWizardHandler {
|
|||
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.ManagedProject;
|
||||
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.runtime.CoreException;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public class StdProjectTypeHandler extends CWizardHandler {
|
||||
public class STDWizardHandler extends MBSWizardHandler {
|
||||
|
||||
public StdProjectTypeHandler(String _name, Image _image, Composite p) {
|
||||
super(_name, null, _image, p, null);
|
||||
public STDWizardHandler(String _name, Image _image, Composite p, IWizard w) {
|
||||
super(_name, null, _image, p, null, w);
|
||||
}
|
||||
|
||||
public void addTc(IToolChain tc) {
|
||||
if (tc == null) {
|
||||
tcs.put(Messages.getString("StdProjectTypeHandler.0"), null); //$NON-NLS-1$
|
||||
tcs.put(UIMessages.getString("StdProjectTypeHandler.0"), null); //$NON-NLS-1$
|
||||
} else {
|
||||
if (tc.isAbstract() || tc.isSystemObject()) return;
|
||||
// unlike CWizardHandler, we don't check for configs
|
||||
|
@ -46,18 +47,18 @@ public class StdProjectTypeHandler extends CWizardHandler {
|
|||
/**
|
||||
* 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();
|
||||
// ICProjectDescription des = coreModel.getProjectDescription(project);
|
||||
// des = coreModel.createProjectDescription(project, true);
|
||||
ICProjectDescription des = coreModel.createProjectDescription(project, false);
|
||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||
ManagedProject mProj = new ManagedProject(des);
|
||||
info.setManagedProject(mProj);
|
||||
|
||||
|
||||
CfgHolder[] cfgs = fConfigPage.getCfgItems(defaults);
|
||||
|
||||
for (int i=0; i<cfgs.length; i++) {
|
||||
String s = (cfgs[i].tc == null) ? "0" : cfgs[i].tc.getId(); //$NON-NLS-1$
|
||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].tc, ManagedBuildManager.calculateChildId(s, null), cfgs[i].name);
|
||||
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
||||
IBuilder bld = cfg.getEditableBuilder();
|
||||
if (bld != null) {
|
||||
if(bld.isInternalBuilder()){
|
||||
|
@ -69,7 +70,7 @@ public class StdProjectTypeHandler extends CWizardHandler {
|
|||
}
|
||||
bld.setManagedBuildOn(false);
|
||||
} 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());
|
||||
CConfigurationData data = cfg.getConfigurationData();
|
||||
|
@ -88,5 +89,4 @@ public class StdProjectTypeHandler extends CWizardHandler {
|
|||
else
|
||||
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.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
import org.eclipse.cdt.ui.wizards.WizardItemData;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
|
||||
public class StdBuildWizard extends AbstractCWizard {
|
||||
|
||||
public void createItems(Tree tree, boolean supportedOnly) {
|
||||
StdProjectTypeHandler h = new StdProjectTypeHandler(Messages.getString("StdBuildWizard.0"), IMG0, parent); //$NON-NLS-1$
|
||||
public WizardItemData[] createItems(boolean supportedOnly, IWizard wizard) {
|
||||
STDWizardHandler h = new STDWizardHandler(Messages.getString("StdBuildWizard.0"), IMG0, parent, wizard); //$NON-NLS-1$
|
||||
h.addTc(null); // add default toolchain
|
||||
IToolChain[] tcs = ManagedBuildManager.getRealToolChains();
|
||||
for (int i=0; i<tcs.length; i++)
|
||||
if (!supportedOnly || isValid(tcs[i])) h.addTc(tcs[i]);
|
||||
TreeItem ti = new TreeItem(tree, SWT.NONE);
|
||||
ti.setText(h.getName());
|
||||
ti.setData(h);
|
||||
ti.setImage(h.getIcon());
|
||||
WizardItemData wd = new WizardItemData();
|
||||
wd.name = h.getName();
|
||||
wd.handler = h;
|
||||
wd.image = h.getIcon();
|
||||
wd.id = h.getName();
|
||||
wd.parentId = null;
|
||||
return new WizardItemData[] {wd};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -396,4 +396,5 @@ exportWizard.CDTCategory.name = C/C++
|
|||
page.c.general=C/C++ General
|
||||
# menu labels
|
||||
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="foldingStructureProviders" name="%foldingStructureProvidersExtensionPoint" schema="schema/foldingStructureProviders.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 -->
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* 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.graphics.Point;
|
|
@ -495,3 +495,44 @@ StructureTreeTab.9=Value
|
|||
StructureTreeTab.10=Class
|
||||
StructureTreeTab.11=Wait...
|
||||
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
|
||||
* 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.IOException;
|
||||
import java.net.URI;
|
||||
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.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -41,14 +39,14 @@ import org.eclipse.swt.widgets.Text;
|
|||
*
|
||||
*/
|
||||
public class ProjectContentsArea {
|
||||
private static final String ERROR_INVALID_PATH = Messages.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_NOT_ABSOLUTE = Messages.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_CANNOT_CREATE = Messages.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_INVALID_PATH = UIMessages.getString("ProjectContentsArea.3"); //$NON-NLS-1$
|
||||
private static final String ERROR_PATH_EMPTY = UIMessages.getString("ProjectContentsArea.4"); //$NON-NLS-1$
|
||||
private static final String ERROR_NOT_ABSOLUTE = UIMessages.getString("ProjectContentsArea.6"); //$NON-NLS-1$
|
||||
private static final String ERROR_NOT_VALID = UIMessages.getString("ProjectContentsArea.7"); //$NON-NLS-1$
|
||||
private static final String ERROR_CANNOT_CREATE = UIMessages.getString("ProjectContentsArea.8"); //$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 String FILE_SCHEME = "file"; //$NON-NLS-1$
|
||||
private Label locationLabel;
|
||||
|
@ -85,7 +83,7 @@ public class ProjectContentsArea {
|
|||
projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
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);
|
||||
GridData buttonData = new GridData();
|
||||
buttonData.horizontalSpan = 4;
|
||||
|
@ -129,7 +127,7 @@ public class ProjectContentsArea {
|
|||
private void createUserEntryArea(Composite composite, boolean defaultEnabled) {
|
||||
// location label
|
||||
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
|
||||
locationPathField = new Text(composite, SWT.BORDER);
|
||||
|
@ -222,7 +220,7 @@ public class ProjectContentsArea {
|
|||
}
|
||||
|
||||
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);
|
||||
selectedDirectory = dialog.open();
|
||||
|
|
@ -8,16 +8,11 @@
|
|||
* Contributors:
|
||||
* 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.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.ArrayList;
|
||||
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.IResource;
|
||||
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.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -47,11 +43,17 @@ import org.eclipse.swt.widgets.Tree;
|
|||
import org.eclipse.swt.widgets.TreeItem;
|
||||
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$
|
||||
|
||||
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 CLASS_NAME = "class"; //$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 Label right_label;
|
||||
|
||||
private CConfigWizardPage next;
|
||||
private ProjectContentsArea locationArea;
|
||||
protected ICWizardHandler h_selected = null;
|
||||
public ICWizardHandler h_selected = null;
|
||||
|
||||
/**
|
||||
* Creates a new project creation wizard page.
|
||||
*
|
||||
* @param pageName the name of this page
|
||||
*/
|
||||
public CMainWizardPage(String pageName, CConfigWizardPage _next) {
|
||||
public CDTMainWizardPage(String pageName) {
|
||||
super(pageName);
|
||||
setPageComplete(false);
|
||||
next = _next;
|
||||
}
|
||||
|
||||
/** (non-Javadoc)
|
||||
|
@ -107,7 +107,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
|
||||
createDynamicGroup(composite);
|
||||
|
||||
switchTo(updateData(tree, right, show_sup, CMainWizardPage.this));
|
||||
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()));
|
||||
|
||||
setPageComplete(validatePage());
|
||||
// Show description on opening
|
||||
|
@ -122,7 +122,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
c.setLayout(new GridLayout(2, true));
|
||||
|
||||
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.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
|
@ -145,7 +145,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
right.setLayout(new PageLayout());
|
||||
|
||||
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);
|
||||
gd.horizontalSpan = 2;
|
||||
show_sup.setLayoutData(gd);
|
||||
|
@ -153,7 +153,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
public void widgetSelected(SelectionEvent e) {
|
||||
if (h_selected != null)
|
||||
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
|
||||
|
@ -176,9 +176,9 @@ import org.eclipse.ui.PlatformUI;
|
|||
}
|
||||
|
||||
public IWizardPage getNextPage() {
|
||||
if (h_selected == null || h_selected.isDummy()) // cannot continue
|
||||
if (h_selected == null) // cannot continue
|
||||
return null;
|
||||
return next;
|
||||
return h_selected.getSpecificPage();
|
||||
}
|
||||
/**
|
||||
* Creates the project name specification controls.
|
||||
|
@ -195,7 +195,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
|
||||
// new project label
|
||||
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());
|
||||
|
||||
// new project name entry field
|
||||
|
@ -304,7 +304,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
|
||||
String projectFieldContents = getProjectNameFieldValue();
|
||||
if (projectFieldContents.length() == 0) {
|
||||
setErrorMessage(Messages.getString("CMainWizardPage.9")); //$NON-NLS-1$
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.9")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -316,29 +316,29 @@ import org.eclipse.ui.PlatformUI;
|
|||
}
|
||||
|
||||
boolean bad = true; // should we treat existing project as error
|
||||
|
||||
|
||||
IProject handle = getProjectHandle();
|
||||
if (handle.exists()) {
|
||||
if (getWizard() instanceof NewModelProjectWizard) {
|
||||
NewModelProjectWizard w = (NewModelProjectWizard)getWizard();
|
||||
if (w.lastProjectName != null && w.lastProjectName.equals(getProjectName()))
|
||||
if (getWizard() instanceof IWizardWithMemory) {
|
||||
IWizardWithMemory w = (IWizardWithMemory)getWizard();
|
||||
if (w.getLastProjectName() != null && w.getLastProjectName().equals(getProjectName()))
|
||||
bad = false;
|
||||
}
|
||||
if (bad) {
|
||||
setErrorMessage(Messages.getString("CMainWizardPage.10")); //$NON-NLS-1$
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.10")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bad) { // skip this check if project already created
|
||||
IPath p = getProjectLocation();
|
||||
if (p == null) p = ResourcesPlugin.getWorkspace().getRoot().getLocation();
|
||||
File f = p.append(getProjectName()).toFile();
|
||||
if (f.exists()) {
|
||||
if (f.isDirectory())
|
||||
setErrorMessage(Messages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
||||
else
|
||||
setErrorMessage(Messages.getString("CMainWizardPage.7")); //$NON-NLS-1$
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.7")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -353,23 +353,20 @@ import org.eclipse.ui.PlatformUI;
|
|||
}
|
||||
|
||||
if (tree.getItemCount() == 0) {
|
||||
setErrorMessage(Messages.getString("CMainWizardPage.3")); //$NON-NLS-1$
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.3")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
|
||||
// it is not an error, but we cannot continue
|
||||
if (h_selected == null || h_selected.isDummy()) {
|
||||
if (h_selected == null) {
|
||||
setErrorMessage(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! h_selected.canCreateWithoutToolchain()) {
|
||||
IToolChain tcs[] = h_selected.getSelectedToolChains();
|
||||
int cnt = tcs != null ? tcs.length : 0;
|
||||
if (cnt == 0) {
|
||||
setErrorMessage(Messages.getString("CMainWizardPage.4")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
String s = h_selected.getErrorMessage();
|
||||
if (s != null) {
|
||||
setErrorMessage(s);
|
||||
return false;
|
||||
}
|
||||
|
||||
setErrorMessage(null);
|
||||
|
@ -392,7 +389,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
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
|
||||
TreeItem[] sel = tree.getSelection();
|
||||
String savedStr = (sel.length > 0) ? sel[0].getText() : null;
|
||||
|
@ -403,6 +400,8 @@ import org.eclipse.ui.PlatformUI;
|
|||
if (extensionPoint == null) return null;
|
||||
IExtension[] extensions = extensionPoint.getExtensions();
|
||||
if (extensions == null) return null;
|
||||
|
||||
ArrayList items = new ArrayList();
|
||||
for (int i = 0; i < extensions.length; ++i) {
|
||||
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
|
||||
for (int k = 0; k < elements.length; k++) {
|
||||
|
@ -411,16 +410,20 @@ import org.eclipse.ui.PlatformUI;
|
|||
try {
|
||||
w = (ICNewWizard) elements[k].createExecutableExtension(CLASS_NAME);
|
||||
} 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;
|
||||
}
|
||||
if (w == null) return null;
|
||||
|
||||
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) {
|
||||
TreeItem target = tree.getItem(0);
|
||||
// try to search item which was selected before
|
||||
|
@ -439,40 +442,72 @@ import org.eclipse.ui.PlatformUI;
|
|||
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
|
||||
*/
|
||||
private void switchTo(ICWizardHandler h) {
|
||||
if (h == null) return;
|
||||
if (h_selected != null) h_selected.handleUnSelection();
|
||||
h_selected = h;
|
||||
if (h == null) return;
|
||||
right_label.setText(h_selected.getHeader());
|
||||
h_selected.handleSelection();
|
||||
next.setHandler(h_selected);
|
||||
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) {
|
||||
if ( !h_selected.canCreateWithoutToolchain())
|
||||
setPageComplete(validatePage());
|
||||
setPageComplete(validatePage());
|
||||
}
|
||||
|
||||
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:
|
||||
* 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.Tree;
|
||||
|
||||
|
||||
/**
|
||||
* Interface to be used by extension point:
|
||||
|
@ -29,10 +30,10 @@ public interface ICNewWizard {
|
|||
* each of them should have data object attached,
|
||||
* data should be lt;ICProjectTypeHandler>
|
||||
*
|
||||
* @param tree - parent tree object
|
||||
* @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
|
||||
|
@ -45,5 +46,5 @@ public interface ICNewWizard {
|
|||
* May be null if notification is not required
|
||||
* 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:
|
||||
* Intel Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||
package org.eclipse.cdt.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;
|
||||
|
||||
|
||||
public interface ICWizardHandler {
|
||||
static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$
|
||||
|
||||
void handleSelection();
|
||||
void handleUnSelection();
|
||||
String getName();
|
||||
Image getIcon();
|
||||
String getHeader();
|
||||
void createProject(IProject proj, CfgHolder[] cfgs) throws CoreException;
|
||||
boolean isDummy();
|
||||
public IToolChain[] getSelectedToolChains();
|
||||
public int getToolChainsCount();
|
||||
public IProjectType getProjectType();
|
||||
public String getPropertyId();
|
||||
/**
|
||||
* Called when user selects corresponding item in wizard tree
|
||||
*
|
||||
* @parame pane - parent for handler-specific data
|
||||
*/
|
||||
public void handleSelection();
|
||||
/**
|
||||
* Called when user leaves corresponding item in wizard tree
|
||||
*/
|
||||
public void handleUnSelection();
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
@ -42,10 +63,6 @@ public interface ICWizardHandler {
|
|||
* @param 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
|
||||
*/
|
||||
|
@ -56,5 +73,19 @@ public interface ICWizardHandler {
|
|||
* @param prefs - list of strings (preferred Toolchain IDs)
|
||||
*/
|
||||
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:
|
||||
* 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
|
||||
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
|||
* to be informed about changes in tool chains selection
|
||||
* performed by ICNewWizard implementors.
|
||||
*/
|
||||
public interface IToolChainListListener {
|
||||
public interface IWizardItemsListListener {
|
||||
/**
|
||||
* Called by ICNewWizard instance when
|
||||
* 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