This is how I got it
to
work:
Here is a portion of
my plugin.xml file with comments:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.cdt.managedbuilder.ui.newWizardPages">
<wizardPage
ID="addProjectWizards.wizardPage1"
operationClass="addProjectRunnables.AIMWizardPageRunnable"
<!-- you must write this class which is called
when you press "Finish"
on the last page of the wizard. Use this to read the
options entered on each wizard page
and to generate your project
This class must implement the IRunnableWithProgress
interface:
public class AIMWizardPageRunnable implements
IRunnableWithProgress {
......
......
......
/***
* createFolder
* Create a folder in the project
* @folder is the folder to create
*/
private static void createFolder(IFolder folder)
throws CoreException {
IContainer parent = folder.getParent();
if (parent instanceof IFolder) {
createFolder((IFolder) parent);
}
if (!folder.exists()) {
folder.create(false, true, null);
}
}
/**
* Create the desired folder structure.
*
* @newProject is the handle to the project being
created
* @param paths is an array of strings describing
the folders to create
*/
private static void addToProjectStructure(IProject
newProject, String[] paths) throws CoreException {
for (String path : paths) {
IFolder etcFolders =
newProject.getFolder(path);
createFolder(etcFolders);
}
}
@Override
public void run(final IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
// write code here which reads widgets from your
wizard and creates the project)
// Create project structure in workspace...
String[] paths = new String[2];
paths[0] = "src";
paths[1] = "src/folder1";
addToProjectStructure(project, paths);
// it's probably not how it should be done,
but I modify a .cproject file based on the user choices and copy
it into the project
modifyFile(tempFolderPath+".cproject");
copyFile(tempFolderPath+".cproject",
".cproject", project);
}
-->
pageClass="addProjectWizards.AIMWizardPage">
<!-- you must write this class which is your
wizard page (here there is only one)
This class must extend the MBSCustomPage class:
public class AIMWizardPage extends MBSCustomPage
implements org.eclipse.jface.wizard.IWizardPage {
......
......
......
public boolean canFlipToNextPage() {
return false; // true if there's
another page -> must manage this
}
@Override
public void createControl(Composite
parent) {
// here you must display widgets (text
zones, radio buttons etc. within a composite
}
// this is how I display a header image. The
image is in the icons folder in the root of your plugin
@Override
public Image getImage() {
return new Image(null,
AIMWizardPage.class.getResourceAsStream("/icons/"+headerImage.png));
}
// to display a title
@Override
public String getTitle() {
return new String("Hardware Manager");
}
// etc...
}
-->
<toolchain
toolchainID="addProject.cdt.managedbuild.toolchain.gnu.cross.exe.debug2">
</toolchain>
</wizardPage>
</extension>
<extension
id="addProject.buildDefinitions2"
name="Build Definitions"
point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
<projectType <!-- this defines your project type
which will appear on the first page of the wizard-->
id="addProject.projectType2"
isAbstract="false"
isTest="false"
name="My Project">
<configuration
cleanCommand="rm –f"
id="addProject.configuration2"
name="Debug2">
<toolChain
id="addProject.cdt.managedbuild.toolchain.gnu.cross.exe.debug2"
isAbstract="false"
name="Cross GCC"
osList="win32">
<tool
id="addProject.tool2"
isAbstract="false"
name="gcc"
outputFlag="-o">
<inputType
dependencyContentType="org.eclipse.cdt.core.cHeader"
id="addProject.inputType2"
name="compiler input"
primaryInput="true"
sourceContentType="org.eclipse.cdt.core.cSource">
</inputType>
<outputType
buildVariable="OBJS"
id="addProject.outputType2"
name="output type"
outputs="o"
primaryOutput="true">
</outputType>
</tool>
<builder
command="aim-make"
id="addProject.builder2"
isAbstract="false"
isVariableCaseSensitive="false"
name="My Builder">
</builder>
<targetPlatform
binaryParser="org.eclipse.cdt.core.ELF"
id="addProject.targetPlatform2"
isAbstract="false"
name="My Target Platform"
osList="win32">
</targetPlatform>
</toolChain>
</configuration>
<!-- You may define other configurations which can be
chosen on the second page of the wizard-->
</projectType>
</extension>
</plugin>
I hope this helps,
Antony
On 15/04/2014 15:16, Chris Recoskie wrote: