Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Programatically adding facets to a pre-existing project
Programatically adding facets to a pre-existing project [message #204480] Thu, 15 November 2007 21:27 Go to next message
bouge is currently offline bouge
Messages: 13
Registered: July 2009
Junior Member
Hi,
We need to provide support for upgrading our users projects. We have
projects that are several years old and would like to 'add' facets to them
in our upgrade process. Does anyone have any insight into this?

Much appreciated,
mike
Re: Programatically adding facets to a pre-existing project [message #204487 is a reply to message #204480] Thu, 15 November 2007 21:37 Go to previous messageGo to next message
John Kenny is currently offline John Kenny
Messages: 62
Registered: July 2009
Member
See my post from 11/2/2207 in this group called "new proj wizard". Here
is what you can do to programtically add the facets to make a project a
dynamic web module:

// add the java and web facets
IFacetedProject fp = ProjectFacetsManager.create(proj, true, null);

fp.installProjectFacet(ProjectFacetsManager.getProjectFacet( "jst.java")
.getDefaultVersion(), null, null);

fp.installProjectFacet(ProjectFacetsManager.getProjectFacet( "jst.web")
.getDefaultVersion(), null, null);



Mike Bourgeois wrote:
> Hi,
> We need to provide support for upgrading our users projects. We have
> projects that are several years old and would like to 'add' facets to
> them in our upgrade process. Does anyone have any insight into this?
> Much appreciated,
> mike
>
>
>
>
Re: Programatically adding facets to a pre-existing project [message #204494 is a reply to message #204480] Thu, 15 November 2007 21:40 Go to previous messageGo to next message
bouge is currently offline bouge
Messages: 13
Registered: July 2009
Junior Member
Actually after reading the project thread below I think I'm all set.
Looks like ProjectFacetsManager does everything I need to know about.
Thanks,
bouge
Re: Programatically adding facets to a pre-existing project [message #204502 is a reply to message #204487] Thu, 15 November 2007 21:42 Go to previous messageGo to next message
bouge is currently offline bouge
Messages: 13
Registered: July 2009
Junior Member
that thread is very useful! I see that the ProjectFacetsManager api's
will convert the project to a faceted project if necessary. Thanks!
bouge
Re: Programatically adding facets to a pre-existing project [message #204629 is a reply to message #204494] Fri, 16 November 2007 16:01 Go to previous messageGo to next message
bouge is currently offline bouge
Messages: 13
Registered: July 2009
Junior Member
ProjectFacetsManager handles our core usecase of upgrading a facet-less
preject to our new facet beautifully! One issue I'm hitting is that
because we depend on jst.java and jst.web, I need to be able to set the
jst.web Content directory path in some circumstances. By default, it
sets the content dir to 'WebContent', but there are instances were I
need to set that to something different. I am familiar with setting
facet properties via the DataModel, but does that apply when using the
ProjectFacetsManager api's? Sorry if I'm missing something obvious here.

Also, does anybody happen to know if jst.web can have no content
directory set? That is, having WEB-INF at the root of the project,
instead of buried in the content dir?

Thanks again,
bouge




Mike Bourgeois wrote:
> Actually after reading the project thread below I think I'm all set.
> Looks like ProjectFacetsManager does everything I need to know about.
> Thanks,
> bouge
>
>
>
>
Re: Programatically adding facets to a pre-existing project [message #204634 is a reply to message #204629] Fri, 16 November 2007 16:48 Go to previous messageGo to next message
Eclipse User
Originally posted by: kosta.bea.com

Here is how you can get at the datamodel that you can use to
parameterize the installation of the jst.web facet. I believe you can
set web content path to project root, but I don't recall exactly which
value you have to use. Experiment with either null or an empty string.

IProjectFacetVersion jstWebSomething = ...

IActionDefinition actionDef = jstWebSomething.getActionDefinition(
IFacetedProject.Action.Type.INSTALL );

IDataModel dm = (IDataModel) actionDef.createConfigObject();

Hope this helps,

- Konstantin
Re: Programatically adding facets to a pre-existing project [message #205393 is a reply to message #204634] Wed, 05 December 2007 20:29 Go to previous message
bouge is currently offline bouge
Messages: 13
Registered: July 2009
Junior Member
No such luck with empty string, null, /, ., etc... Any other ideas on
how to set the webfacet to point to the project root for it's contentdir?

Looking at the WebFacetInstallDelegate leads me to beleive that it's
expecting a path name under project.

Thanks again,
bouge




Konstantin Komissarchik wrote:
> Here is how you can get at the datamodel that you can use to
> parameterize the installation of the jst.web facet. I believe you can
> set web content path to project root, but I don't recall exactly which
> value you have to use. Experiment with either null or an empty string.
>
> IProjectFacetVersion jstWebSomething = ...
>
> IActionDefinition actionDef = jstWebSomething.getActionDefinition(
> IFacetedProject.Action.Type.INSTALL );
>
> IDataModel dm = (IDataModel) actionDef.createConfigObject();
>
> Hope this helps,
>
> - Konstantin
Previous Topic:Eclipse plug in for JRUN
Next Topic:Re: Migration from JBuilder (Export dependencies)
Goto Forum:
  


Current Time: Fri Oct 31 17:24:32 GMT 2014

Powered by FUDForum. Page generated in 0.01983 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software