i writing an Eclipse Plugin that creates a new "EAR Application Project", using APIs from Eclipse WTP. I m issuing some difficulties to set the "runtime" value for this new project.
That's the content of "org.eclipse.wst.common.project.facet.core.xml" when I create the same project using Eclipse GUI (as an 'normal' user):
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish 3.1.2"/>
<fixed facet="jst.ear"/>
<installed facet="jst.ear" version="6.0"/>
<installed facet="sun.facet" version="9"/>
</faceted-project>
But when creating a Faceted Project (using provided APIs from WTP plugins) I cannot find a way to set the following values to my EAP project:
<runtime name="GlassFish 3.1.2"/>
<fixed facet="jst.ear"/>
following is the same XML that is written when i create this project programmatically:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="jst.ear" version="6.0"/>
<installed facet="sun.facet" version="9"/>
</faceted-project>
Here's how im creating this project:
IFacetedProject facetedProject = ProjectFacetsManager.create("prj1", new Path(prj), null);
IFacetedProjectWorkingCopy workingCopy = facetedProject.createWorkingCopy();
IProjectFacet jstFacet = ProjectFacetsManager.getProjectFacet("jst.ear");
IProjectFacet sunFacet = ProjectFacetsManager.getProjectFacet("sun.facet");
IProjectFacetVersion defaultJstFacet = jstFacet.getDefaultVersion();
IProjectFacetVersion defaultSunFacet = sunFacet.getDefaultVersion();
workingCopy.addProjectFacet(defaultJstFacet);
workingCopy.addProjectFacet(defaultSunFacet);
workingCopy.commitChanges(null);
Am i doing something wrong?