Skip to main content



      Home
Home » Archived » Faceted Project Framework » How to access facets programmaticaly
How to access facets programmaticaly [message #484653] Tue, 08 September 2009 12:01 Go to next message
Eclipse UserFriend
Hello Konstantin,

I have just implemented facets for my plugins. But now I want to perform
some extra tasks programmaticaly:
1. to change a certain facet on a project based on the user actions. For
example, my projects have an interpreter (DLTK model) and when the user
chooses a particular interpreter type I want to change/set one of the
facets the project has.

2. is there an API to work with project facets and with the
org.eclipse.wst.common.project.facet.core.xml file. Is there a facet
registry?

Thanks!

Regards,
Gabriel
www.xqdt.org
Re: How to access facets programmaticaly [message #484703 is a reply to message #484653] Tue, 08 September 2009 15:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi Gabriel,

The framework API entry point is ProjectFacetsManager class. You will be able to use this class to browse through available facets and to create IFacetedProject objects which let you manipulate specific projects.

Here is a small snippet that installs a facet on an existing faceted project:

import org.eclipse.wst.common.project.facet.core.*;

IProjectFacet f = ProjectFacetsManager.getProjectFacet( "my.facet" );
IProjectFacetVersion fv = f.getVersion( "1.0" );
IFacetedProject proj = ProjectFacetsManager.create( [IProject] );
proj.installProjectFacet( fv, null, null );

You may also want to take a look at IFacetedProjectWorkingCopy (accessible via IFacetedProject.createWorkingCopy() among other means). That interface gives you more control in manipulating various aspects of project's configuration before applying all of the changes in bulk.

Hope this helps and don't hesitate to ask more questions.

- Konstantin
Re: How to access facets programmaticaly [message #571960 is a reply to message #484653] Tue, 08 September 2009 15:49 Go to previous message
Eclipse UserFriend
Hi Gabriel,

The framework API entry point is ProjectFacetsManager class. You will be able to use this class to browse through available facets and to create IFacetedProject objects which let you manipulate specific projects.

Here is a small snippet that installs a facet on an existing faceted project:

import org.eclipse.wst.common.project.facet.core.*;

IProjectFacet f = ProjectFacetsManager.getProjectFacet( "my.facet" );
IProjectFacetVersion fv = f.getVersion( "1.0" );
IFacetedProject proj = ProjectFacetsManager.create( [IProject] );
proj.installProjectFacet( fv, null, null );

You may also want to take a look at IFacetedProjectWorkingCopy (accessible via IFacetedProject.createWorkingCopy() among other means). That interface gives you more control in manipulating various aspects of project's configuration before applying all of the changes in bulk.

Hope this helps and don't hesitate to ask more questions.

- Konstantin
Previous Topic:How to access facets programmaticaly
Next Topic:Is Faceted Project Framework supported in Ganymede?
Goto Forum:
  


Current Time: Sun Jul 06 14:18:46 EDT 2025

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

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

Back to the top