diff --git a/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java b/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java deleted file mode 100644 index 9f63f824efd..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java +++ /dev/null @@ -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) {} -} diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/empty.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/empty.gif deleted file mode 100644 index 143e14d1949..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/empty.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/preferred.gif b/build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/preferred.gif deleted file mode 100644 index 270c645753a..00000000000 Binary files a/build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/preferred.gif and /dev/null differ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index b5aca0e687e..222d0bfeaaa 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -4,7 +4,6 @@ - @@ -413,7 +412,7 @@ + point="org.eclipse.cdt.ui.CDTWizard"> diff --git a/build/org.eclipse.cdt.managedbuilder.ui/schema/CDTWizard.exsd b/build/org.eclipse.cdt.managedbuilder.ui/schema/CDTWizard.exsd deleted file mode 100644 index 69841baddec..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/schema/CDTWizard.exsd +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - - - - - diff --git a/build/org.eclipse.cdt.managedbuilder.ui/schema/CNewWizard.exsd b/build/org.eclipse.cdt.managedbuilder.ui/schema/CNewWizard.exsd deleted file mode 100644 index 64af2a6bdc2..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/schema/CNewWizard.exsd +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - - - - - diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PreferredToolchainsTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PreferredToolchainsTab.java index 1ee650739f1..630c8f7bd3a 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PreferredToolchainsTab.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/preferences/PreferredToolchainsTab.java @@ -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 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 - 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()]); } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectWizard.java index 619fe2ce84e..d5f0ec2daab 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectWizard.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectWizard.java @@ -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$ diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CfgHolder.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CfgHolder.java index 29703940bbb..e87600a9273 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CfgHolder.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CfgHolder.java @@ -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; } } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/DummyHandler.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/DummyHandler.java deleted file mode 100644 index e31a0793110..00000000000 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/DummyHandler.java +++ /dev/null @@ -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) {} -} diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ICBuildWizardHandler.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ICBuildWizardHandler.java new file mode 100644 index 00000000000..d32a9a80528 --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ICBuildWizardHandler.java @@ -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(); +} diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java index c7e2c2ad41a..62349b889b8 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSCustomPageManager.java @@ -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(); diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewModelProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSProjectWizard.java similarity index 77% rename from build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewModelProjectWizard.java rename to build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSProjectWizard.java index b4e97ccc4cb..972612b71cb 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewModelProjectWizard.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSProjectWizard.java @@ -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 - + diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/PageLayout.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PageLayout.java similarity index 97% rename from build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/PageLayout.java rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PageLayout.java index 77168612729..c3ec36343e9 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/PageLayout.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PageLayout.java @@ -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; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties index 372e3cf71e4..becad01d361 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/PluginResources.properties @@ -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 diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ProjectContentsArea.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ProjectContentsArea.java similarity index 89% rename from build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ProjectContentsArea.java rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ProjectContentsArea.java index 9a2290c4c9c..c4f64f520ea 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ProjectContentsArea.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ProjectContentsArea.java @@ -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(); diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CMainWizardPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java similarity index 78% rename from build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CMainWizardPage.java rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java index 6d9fee56cf5..512edb967b8 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CMainWizardPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/CDTMainWizardPage.java @@ -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 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