Re: Headless facet installation [message #572678] |
Thu, 22 July 2010 17:00 |
Konstantin Komissarchik Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
Hi Barry,
You haven't indicated what you have tried or what failures you are getting. Note that the Dynamic Web Module facet (id jst.web) requires Java facet (id jst.java).
Here is a standalone snippet...
IProjectFacet javaFacet = ProjectFacetsManager.getProjectFacet( "jst.java" );
IProjectFacet webFacet = ProjectFacetsManager.getProjectFacet( "jst.web" );
Set<IProjectFacet> fixedFacets = new HashSet<IProjectFacet>();
fixedFacets.add( javaFacet );
fixedFacets.add( webFacet );
IFacetedProject fproj = ProjectFacetsManager.create( "my-project", null, null );
fproj.addTargetedRuntime( ..., null );
fproj.installProjectFacet( javaFacet.getVersion( "1.4" ) );
fproj.installProjectFacet( webFacet.getVersion( "2.4" ) );
fproj.setFixedProjectFacets( fixedFacets );
There are various versions of ProjectFacetsManager.create() method that are appropriate for different cases. There is no need to call WtpUtils.addNatures(). That's encapsulated in installation of the web facet.
You can substitute constants for appropriate IProjectFacet and IProjectFacetVersion objects from IJ2EEFacetConstants class.
- Konstantin
|
|
|
Powered by
FUDForum. Page generated in 0.03239 seconds