How to create a RCP programatically? [message #488883] |
Wed, 30 September 2009 10:56  |
Eclipse User |
|
|
|
Hi,
I've been able to create an RCP by using a .product file where I specify
the features and plugins I want to include in the final product. I've used
the "Eclipse Product export wizard" that can be launched directly using the
multipage editor available for .product files (Product Configuration
editor). My question is the following:
Is it possible to do something like this (I mean something similar to what
the wizard does)? I've thought of checking the method
"performFinish" of the class "BaseExportWizard" of
"org.eclipse.pde.internal.ui.wizards.exports" just to see how it's done by
the editor, but everything is "internal" so I've realized the export wizard
is not intended to be launched by anyone other than the editor itself. What
can I do?
Any suggestion will be highly appreciated :-)
Thanks in advance.
Mario
|
|
|
|
|
Re: How to create a RCP programatically? [message #489406 is a reply to message #489154] |
Fri, 02 October 2009 16:37   |
Eclipse User |
|
|
|
If you know how to set up a headless build for your product, then you can consider programmatically generating those files in a temporary folder somewhere. And then running pde.build against that.
Consider something like:
//get pde.build template properties file
Bundle pdeBuild = Platform.getBundle("org.eclipse.pde.build");
URL templateProperties = FileLocator.find(pdeBuild, new Path("templates/headless-build/build.properties"));
//load the template properties, add the properties you need to change, and store the properties somewhere
Properties builderProperties = new Properties();
builderProperties.load( templateProperties.openStream());
builderProperties.put(...);
builderProperties.store(...);
...
//find the pde.build main build.xml
URL buildXML = FileLocator.find(pdeBuild, new Path("scripts/productBuild/productBuild.xml"));
String buildXMLPath = FileLocator.toFileURL(buildXML).getPath();
//run ant on the productBuild.xml
AntRunner runner = new AntRunner(); //from org.eclipse.ant.core
//just like the ant command line
String [] args = new String [] { "-buildfile", buildXmlPath, "-Dbuilder=" + tempFolder, ... };
runner.run((Object) args);
The PDE/Build junit tests do a lot of this kind of thing. You could look at them as an example. The code is in cvs host: dev.eclipse.org, repository path: /cvsroot/eclipse, project: pde/build/org.eclipse.pde.build.tests
|
|
|
|
Powered by
FUDForum. Page generated in 0.25751 seconds