1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 13:25:45 +02:00

Bug #170615: patch from Jason Montojo applied

This commit is contained in:
Oleg Krasilnikov 2007-03-30 09:23:26 +00:00
parent af61b0c34b
commit b5f228114b
9 changed files with 974 additions and 105 deletions

View file

@ -47,4 +47,7 @@
</wizardPage>
</extension>
</plugin>

View file

@ -13,8 +13,16 @@ package org.eclipse.cdt.managedbuilder.ui.tests;
import junit.framework.TestCase;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
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;
@ -22,96 +30,99 @@ import org.eclipse.ui.PlatformUI;
* Tests for the get/setSelectedProjectType() of CProjectPlatformPage.
* @author Elias Volanakis
*/
public class TestCProjectPlatformPage extends TestCase {
public class TestCProjectPlatformPage extends TestCase implements IToolChainListListener {
//TODO: migrate to the new UI functionality
// private NewManagedProjectWizard wizard;
// private TestPage page;
//
// protected void setUp() throws Exception {
// MBSCustomPageManager.init();
// MBSCustomPageManager.loadExtensions();
// wizard = new NewManagedProjectWizard();
// 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 testSelectedProjectType1() throws Exception {
// page.createControl(getShell());
// final IProjectType type2 = page.getSecondType();
//
// TestPage page2 = new TestPage(wizard);
// page2.setSelectedProjectType(type2);
// page2.createControl(getShell());
// assertEquals(type2, page2.getSelectedProjectType());
// page2.dispose();
// }
//
// /* Test the new page, create page, set selection lifecycle. */
// public void testSelectedProjectType2() throws Exception {
// // test get null
// assertNull(page.getSelectedProjectType());
// // test set null
// page.setSelectedProjectType(null);
// assertNull(page.getSelectedProjectType()); // null, since no UI created
//
// // create ui
// page.createControl(getShell());
// final IProjectType type1 = page.getFirstType();
//
// // default behavior if selection set to null -> select first item
// assertEquals(type1, page.getSelectedProjectType());
// // set 2nd element from project types list
// final IProjectType type2 = page.getSecondType();
// assertNotNull(type2);
// page.setSelectedProjectType(type2);
// assertEquals(type2, page.getSelectedProjectType());
// }
//
// /*
// * Tests that setting the selection to a projectType thats not on the list,
// * is handled correctly.
// */
// public void testSelectedProjectType3() throws Exception {
// IProjectType testType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.so");
// assertNotNull(testType);
// assertTrue(testType.isTestProjectType());
// page.setSelectedProjectType(testType);
// page.createControl(getShell());
// // no selection made
// assertNull(null,page.getSelectedProjectType());
// assertFalse(page.canFlipToNextPage());
// }
//
//
// // helping methods and classes
// //////////////////////////////
//
// private Shell getShell() {
// return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
// }
//
// class TestPage extends CProjectPlatformPage {
// TestPage(NewManagedProjectWizard wizard) throws Exception {
// super(TestCProjectPlatformPage.class.getName(), wizard);
// }
// IProjectType getFirstType() {
// return (IProjectType) projectTypes.get(0);
// }
// IProjectType getSecondType() {
// return (IProjectType) projectTypes.get(1);
// }
// }
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) {}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Texas Instruments Incorporated and others.
* Copyright (c) 2005, 2007 Texas Instruments Incorporated 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
@ -7,6 +7,7 @@
*
* Contributors:
* Texas Instruments - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.tests;
@ -19,8 +20,8 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.managedbuilder.ui.tests.util.TestToolchain;
import org.eclipse.cdt.managedbuilder.ui.wizards.CMainWizardPage;
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
import org.eclipse.core.runtime.NullProgressMonitor;
/**
* This class is responsible for testing the functionality of the custom page manager (MBSCustomPageManager)
@ -872,9 +873,9 @@ public class TestCustomPageManager extends TestCase
}
public void testOperation()
public void testOperation() throws Exception
{
MBSCustomPageManager.getPageData(alwaysPresentPageName).getOperation().run();
MBSCustomPageManager.getPageData(alwaysPresentPageName).getOperation().run(new NullProgressMonitor());
if(testFlag != true)
{

View file

@ -0,0 +1,542 @@
package org.eclipse.cdt.managedbuilder.ui.tests.util;
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.PluginVersionIdentifier;
public class TestConfiguration implements IConfiguration {
IToolChain toolchain;
public TestConfiguration(IToolChain tc) {
toolchain = tc;
}
public boolean buildsFileType(String srcExt) {
// TODO Auto-generated method stub
return false;
}
public ITool calculateTargetTool() {
// TODO Auto-generated method stub
return null;
}
public void changeBuilder(IBuilder newBuilder, String id, String name) {
// TODO Auto-generated method stub
}
public IFileInfo createFileInfo(IPath path) {
// TODO Auto-generated method stub
return null;
}
public IFileInfo createFileInfo(IPath path, String id, String name) {
// TODO Auto-generated method stub
return null;
}
public IFileInfo createFileInfo(IPath path, IFolderInfo base,
ITool baseTool, String id, String name) {
// TODO Auto-generated method stub
return null;
}
public IFileInfo createFileInfo(IPath path, IFileInfo base, String id,
String name) {
// TODO Auto-generated method stub
return null;
}
public IFolderInfo createFolderInfo(IPath path) {
// TODO Auto-generated method stub
return null;
}
public IFolderInfo createFolderInfo(IPath path, String id, String name) {
// TODO Auto-generated method stub
return null;
}
public IFolderInfo createFolderInfo(IPath path, IFolderInfo base,
String id, String name) {
// TODO Auto-generated method stub
return null;
}
public IToolChain createToolChain(IToolChain superClass, String Id,
String name, boolean isExtensionElement) {
// TODO Auto-generated method stub
return null;
}
public IManagedCommandLineInfo generateToolCommandLineInfo(
String sourceExtension, String[] flags, String outputFlag,
String outputPrefix, String outputName, String[] inputResources,
IPath inputLocation, IPath outputLocation) {
// TODO Auto-generated method stub
return null;
}
public String getArtifactExtension() {
// TODO Auto-generated method stub
return null;
}
public String getArtifactName() {
// TODO Auto-generated method stub
return null;
}
public String getBuildArguments() {
// TODO Auto-generated method stub
return null;
}
public String getBuildCommand() {
// TODO Auto-generated method stub
return null;
}
public CBuildData getBuildData() {
// TODO Auto-generated method stub
return null;
}
public IConfigurationBuildMacroSupplier getBuildMacroSupplier() {
// TODO Auto-generated method stub
return null;
}
public IBuilder getBuilder() {
// TODO Auto-generated method stub
return null;
}
public String getCleanCommand() {
// TODO Auto-generated method stub
return null;
}
public CConfigurationData getConfigurationData() {
// TODO Auto-generated method stub
return null;
}
public String getDescription() {
// TODO Auto-generated method stub
return null;
}
public IBuilder getEditableBuilder() {
// TODO Auto-generated method stub
return null;
}
public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier() {
// TODO Auto-generated method stub
return null;
}
public String getErrorParserIds() {
// TODO Auto-generated method stub
return null;
}
public String[] getErrorParserList() {
// TODO Auto-generated method stub
return null;
}
public ITool[] getFilteredTools() {
// TODO Auto-generated method stub
return null;
}
public String[] getLibs(String extension) {
// TODO Auto-generated method stub
return null;
}
public IManagedProject getManagedProject() {
// TODO Auto-generated method stub
return null;
}
public String getOutputExtension(String resourceExtension) {
// TODO Auto-generated method stub
return null;
}
public String getOutputFlag(String outputExt) {
// TODO Auto-generated method stub
return null;
}
public String getOutputPrefix(String outputExtension) {
// TODO Auto-generated method stub
return null;
}
public IConfiguration getParent() {
// TODO Auto-generated method stub
return null;
}
public String getPostannouncebuildStep() {
// TODO Auto-generated method stub
return null;
}
public String getPostbuildStep() {
// TODO Auto-generated method stub
return null;
}
public String getPreannouncebuildStep() {
// TODO Auto-generated method stub
return null;
}
public String getPrebuildStep() {
// TODO Auto-generated method stub
return null;
}
public IProjectType getProjectType() {
// TODO Auto-generated method stub
return null;
}
public IResourceConfiguration getResourceConfiguration(String path) {
// TODO Auto-generated method stub
return null;
}
public IResourceConfiguration[] getResourceConfigurations() {
// TODO Auto-generated method stub
return null;
}
public IResourceInfo getResourceInfo(IPath path, boolean exactPath) {
// TODO Auto-generated method stub
return null;
}
public IResourceInfo getResourceInfoById(String id) {
// TODO Auto-generated method stub
return null;
}
public IResourceInfo[] getResourceInfos() {
// TODO Auto-generated method stub
return null;
}
public IFolderInfo getRootFolderInfo() {
// TODO Auto-generated method stub
return null;
}
public IPath[] getSourcePaths() {
// TODO Auto-generated method stub
return null;
}
public ITool getTargetTool() {
// TODO Auto-generated method stub
return null;
}
public ITool getTool(String id) {
// TODO Auto-generated method stub
return null;
}
public IToolChain getToolChain() {
return toolchain;
}
public String getToolCommand(ITool tool) {
// TODO Auto-generated method stub
return null;
}
public ITool getToolFromInputExtension(String sourceExtension) {
// TODO Auto-generated method stub
return null;
}
public ITool getToolFromOutputExtension(String extension) {
// TODO Auto-generated method stub
return null;
}
public ITool[] getTools() {
// TODO Auto-generated method stub
return null;
}
public ITool[] getToolsBySuperClassId(String id) {
// TODO Auto-generated method stub
return null;
}
public String[] getUserObjects(String extension) {
// TODO Auto-generated method stub
return null;
}
public boolean hasOverriddenBuildCommand() {
// TODO Auto-generated method stub
return false;
}
public boolean isBuilderCompatible(IBuilder builder) {
// TODO Auto-generated method stub
return false;
}
public boolean isDirty() {
// TODO Auto-generated method stub
return false;
}
public boolean isExtensionElement() {
// TODO Auto-generated method stub
return false;
}
public boolean isHeaderFile(String ext) {
// TODO Auto-generated method stub
return false;
}
public boolean isManagedBuildOn() {
// TODO Auto-generated method stub
return false;
}
public boolean isSupported() {
// TODO Auto-generated method stub
return false;
}
public boolean isSystemObject() {
// TODO Auto-generated method stub
return false;
}
public boolean isTemporary() {
// TODO Auto-generated method stub
return false;
}
public boolean needsFullRebuild() {
// TODO Auto-generated method stub
return false;
}
public boolean needsRebuild() {
// TODO Auto-generated method stub
return false;
}
public void removeResourceConfiguration(IResourceInfo resConfig) {
// TODO Auto-generated method stub
}
public void removeResourceInfo(IPath path) {
// TODO Auto-generated method stub
}
public void setArtifactExtension(String extension) {
// TODO Auto-generated method stub
}
public void setArtifactName(String name) {
// TODO Auto-generated method stub
}
public void setBuildArguments(String makeArgs) {
// TODO Auto-generated method stub
}
public void setBuildCommand(String command) {
// TODO Auto-generated method stub
}
public void setCleanCommand(String command) {
// TODO Auto-generated method stub
}
public void setDescription(String description) {
// TODO Auto-generated method stub
}
public void setDirty(boolean isDirty) {
// TODO Auto-generated method stub
}
public void setErrorParserIds(String ids) {
// TODO Auto-generated method stub
}
public void setErrorParserList(String[] ids) {
// TODO Auto-generated method stub
}
public void setManagedBuildOn(boolean on) throws BuildException {
// TODO Auto-generated method stub
}
public void setName(String name) {
// TODO Auto-generated method stub
}
public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
throws BuildException {
// TODO Auto-generated method stub
return null;
}
public IOption setOption(IHoldsOptions parent, IOption option, String value)
throws BuildException {
// TODO Auto-generated method stub
return null;
}
public IOption setOption(IHoldsOptions parent, IOption option,
String[] value) throws BuildException {
// TODO Auto-generated method stub
return null;
}
public void setPostannouncebuildStep(String announceStep) {
// TODO Auto-generated method stub
}
public void setPostbuildStep(String step) {
// TODO Auto-generated method stub
}
public void setPreannouncebuildStep(String announceStep) {
// TODO Auto-generated method stub
}
public void setPrebuildStep(String step) {
// TODO Auto-generated method stub
}
public void setRebuildState(boolean rebuild) {
// TODO Auto-generated method stub
}
public void setSourcePaths(IPath[] paths) {
// TODO Auto-generated method stub
}
public void setToolCommand(ITool tool, String command) {
// TODO Auto-generated method stub
}
public boolean supportsBuild(boolean managed) {
// TODO Auto-generated method stub
return false;
}
public String getBaseId() {
// TODO Auto-generated method stub
return null;
}
public String getId() {
// TODO Auto-generated method stub
return null;
}
public String getManagedBuildRevision() {
// TODO Auto-generated method stub
return null;
}
public String getName() {
// TODO Auto-generated method stub
return null;
}
public PluginVersionIdentifier getVersion() {
// TODO Auto-generated method stub
return null;
}
public void setVersion(PluginVersionIdentifier version) {
// TODO Auto-generated method stub
}
public IBuildObjectProperties getBuildProperties() {
// TODO Auto-generated method stub
return null;
}
public IResource getOwner() { return null; }
public IResourceConfiguration createResourceConfiguration(IFile file) {
// TODO Auto-generated method stub
return null;
}
public IBuildPropertyValue getBuildArtefactType() {
// TODO Auto-generated method stub
return null;
}
public void setBuildArtefactType(String id) throws BuildException {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,224 @@
package org.eclipse.cdt.managedbuilder.ui.tests.util;
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IModificationStatus;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.PluginVersionIdentifier;
public class TestFolderInfo implements IFolderInfo {
IConfiguration cfg;
public TestFolderInfo(IConfiguration parent) {
cfg = parent;
}
public boolean buildsFileType(String srcExt) {
// TODO Auto-generated method stub
return false;
}
public IToolChain changeToolChain(IToolChain newSuperClass, String Id,
String name) throws BuildException {
// TODO Auto-generated method stub
return null;
}
public ITool[] getFilteredTools() {
// TODO Auto-generated method stub
return null;
}
public CFolderData getFolderData() {
// TODO Auto-generated method stub
return null;
}
public String getOutputExtension(String resourceExtension) {
// TODO Auto-generated method stub
return null;
}
public ITool getTool(String id) {
// TODO Auto-generated method stub
return null;
}
public IToolChain getToolChain() {
// TODO Auto-generated method stub
return null;
}
public IModificationStatus getToolChainModificationStatus(ITool[] removed,
ITool[] added) {
// TODO Auto-generated method stub
return null;
}
public ITool getToolFromInputExtension(String sourceExtension) {
// TODO Auto-generated method stub
return null;
}
public ITool getToolFromOutputExtension(String extension) {
// TODO Auto-generated method stub
return null;
}
public ITool[] getToolsBySuperClassId(String id) {
// TODO Auto-generated method stub
return null;
}
public boolean isHeaderFile(String ext) {
// TODO Auto-generated method stub
return false;
}
public boolean isToolChainCompatible(IToolChain ch) {
// TODO Auto-generated method stub
return false;
}
public void modifyToolChain(ITool[] removed, ITool[] added)
throws BuildException {
// TODO Auto-generated method stub
}
public CLanguageData[] getCLanguageDatas() {
// TODO Auto-generated method stub
return null;
}
public int getKind() {
// TODO Auto-generated method stub
return 0;
}
public IConfiguration getParent() {
return cfg;
}
public IPath getPath() {
// TODO Auto-generated method stub
return null;
}
public CResourceData getResourceData() {
// TODO Auto-generated method stub
return null;
}
public ITool[] getTools() {
// TODO Auto-generated method stub
return null;
}
public boolean isDirty() {
// TODO Auto-generated method stub
return false;
}
public boolean isExcluded() {
// TODO Auto-generated method stub
return false;
}
public boolean isExtensionElement() {
// TODO Auto-generated method stub
return false;
}
public boolean isValid() {
// TODO Auto-generated method stub
return false;
}
public boolean needsRebuild() {
// TODO Auto-generated method stub
return false;
}
public void setDirty(boolean dirty) {
// TODO Auto-generated method stub
}
public void setExclude(boolean excluded) {
// TODO Auto-generated method stub
}
public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
throws BuildException {
// TODO Auto-generated method stub
return null;
}
public IOption setOption(IHoldsOptions parent, IOption option, String value)
throws BuildException {
// TODO Auto-generated method stub
return null;
}
public IOption setOption(IHoldsOptions parent, IOption option,
String[] value) throws BuildException {
// TODO Auto-generated method stub
return null;
}
public void setPath(IPath path) {
// TODO Auto-generated method stub
}
public void setRebuildState(boolean rebuild) {
// TODO Auto-generated method stub
}
public boolean supportsBuild(boolean managed) {
// TODO Auto-generated method stub
return false;
}
public String getBaseId() {
// TODO Auto-generated method stub
return null;
}
public String getId() {
// TODO Auto-generated method stub
return null;
}
public String getManagedBuildRevision() {
// TODO Auto-generated method stub
return null;
}
public String getName() {
// TODO Auto-generated method stub
return null;
}
public PluginVersionIdentifier getVersion() {
// TODO Auto-generated method stub
return null;
}
public void setVersion(PluginVersionIdentifier version) {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,49 @@
package org.eclipse.cdt.managedbuilder.ui.tests.util;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
import org.eclipse.core.runtime.PluginVersionIdentifier;
public class TestProjectType implements IProjectType {
private IConfiguration[] cfgs = new IConfiguration[1];
public TestProjectType() {
cfgs[0] = new TestConfiguration(new TestToolchain());
}
public boolean checkForMigrationSupport() { return false; }
public IConfiguration createConfiguration(IConfiguration parent, String id,
String name) { return null; }
public IProjectBuildMacroSupplier getBuildMacroSupplier() { return null; }
public IConfiguration getConfiguration(String id) { return null; }
public IConfigurationNameProvider getConfigurationNameProvider() { return null; }
public IConfiguration[] getConfigurations() { return cfgs; }
public String getConvertToId() { return null; }
public IProjectEnvironmentVariableSupplier getEnvironmentVariableSupplier() { return null; }
public String getNameAttribute() { return null; }
public IProjectType getSuperClass() { return null; }
public String getUnusedChildren() { return null; }
public boolean isAbstract() { return false; }
public boolean isSupported() { return false; }
public boolean isTestProjectType() { return false; }
public void removeConfiguration(String id) {}
public void setConvertToId(String convertToId) {}
public void setIsAbstract(boolean b) {}
public String getBaseId() { return null; }
public String getId() { return null; }
public String getManagedBuildRevision() { return null; }
public String getName() { return null; }
public PluginVersionIdentifier getVersion() { return null; }
public void setVersion(PluginVersionIdentifier version) {}
public IBuildObjectProperties getBuildProperties() { return null; }
public IBuildPropertyValue getBuildArtefactType() {
return null;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005 Texas Instruments Incorporated and others.
* Copyright (c) 2005, 2007 Texas Instruments Incorporated 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
@ -7,11 +7,16 @@
*
* Contributors:
* Texas Instruments - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
import java.lang.reflect.InvocationTargetException;
import java.util.Set;
import java.util.TreeSet;
import java.util.Iterator;
@ -30,7 +35,7 @@ public final class MBSCustomPageData
private IWizardPage wizardPage = null;
private Runnable operation = null;
private IRunnableWithProgress operation = null;
private String id = null;
@ -95,6 +100,21 @@ public final class MBSCustomPageData
public MBSCustomPageData(String id, IWizardPage wizardPage,
Runnable operation, boolean isStock)
{
this(id, wizardPage, convertRunnable(operation), isStock);
}
/**
* Contstructs a custom page data record
*
* @param id - Unique ID of the page
* @param wizardPage - the IWizardPage that is displayed in the wizard
* @param operation - the Runnable() that is executed during the wizard's DoRunEpilogue() method, or null if no operation is specified
* @param isStock - true if the page is a stock page provided by Managed Build, false otherwise.
* @since 3.0
*/
public MBSCustomPageData(String id, IWizardPage wizardPage,
IRunnableWithProgress operation, boolean isStock)
{
this.id = id;
this.wizardPage = wizardPage;
@ -365,13 +385,24 @@ public final class MBSCustomPageData
}
/**
* @return the java.lang.Runnable() operation associated with this page that should be run during
* @return the {@link IRunnableWithProgress} operation associated with this page that should be run during
* the wizard's doRunEpilogue() method. This operation should only be executed if in fact the page
* is visible.
* @since 3.0
*/
public Runnable getOperation()
public IRunnableWithProgress getOperation()
{
return operation;
}
private static IRunnableWithProgress convertRunnable(final Runnable runnable) {
if (runnable == null) {
return null;
}
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
runnable.run();
}
};
}
}

View file

@ -8,6 +8,7 @@
* Contributors:
* Texas Instruments - initial API and implementation
* Intel Corporation - adaptation to new project model
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.wizards;
@ -29,6 +30,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
/**
@ -511,7 +513,7 @@ public final class MBSCustomPageManager
*/
public static void addStockPage(IWizardPage page, String pageID)
{
MBSCustomPageData pageData = new MBSCustomPageData(pageID, page, null, true);
MBSCustomPageData pageData = new MBSCustomPageData(pageID, page, (IRunnableWithProgress) null, true);
idToPageDataMap.put(pageID, pageData);
pageSet.add(pageData);
}
@ -668,7 +670,7 @@ public final class MBSCustomPageManager
*
* @since 3.0
*/
public static Runnable[] getOperations()
public static IRunnableWithProgress[] getOperations()
{
Set operationSet = new LinkedHashSet();
@ -694,12 +696,12 @@ public final class MBSCustomPageManager
Iterator iterator = operationSet.iterator();
Runnable[] operations = new Runnable[operationSet.size()];
IRunnableWithProgress[] operations = new IRunnableWithProgress[operationSet.size()];
int k = 0;
while (iterator.hasNext())
{
operations[k++] = (Runnable) iterator.next();
operations[k++] = (IRunnableWithProgress) iterator.next();
}
return operations;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2005 Rational Software Corporation and others.
* Copyright (c) 2002, 2007 Rational Software 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
@ -230,10 +230,16 @@ public abstract class NewModelProjectWizard extends BasicNewResourceWizard imple
}
private void doCustom() {
Runnable operations[] = MBSCustomPageManager.getOperations();
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
if(operations != null)
for(int k = 0; k < operations.length; k++)
operations[k].run();
try {
getContainer().run(false, true, operations[k]);
} catch (InvocationTargetException e) {
ManagedBuilderUIPlugin.log(e);
} catch (InterruptedException e) {
ManagedBuilderUIPlugin.log(e);
}
}
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {