}
IFacetedProject facetedProject = null;
boolean hasComposerFacet = false;
Set<IFacetedProject> facetedProjects = ProjectFacetsManager.getFacetedProjects();
IProjectFacet composerFacet = ProjectFacetsManager.getProjectFacet(ComposerFacetConstants.COMPOSER_COMPONENT);
for (IFacetedProject fp : facetedProjects) {
if (project.getName().equals(fp.getProject().getName()) && fp.hasProjectFacet(composerFacet)) {
hasComposerFacet = true;
break;
}
}
if (!hasComposerFacet) {
facetedProject = com.dubture.composer.core.facet.FacetManager.installFacets(project, version, monitor);
} else {
facetedProject = ProjectFacetsManager.create(project);
}
if (facetedProject == null) {
Logger.log(Logger.WARNING, "Could not retrieve a symfony faceted project to install the facet.");
return;
}
IProjectFacet symfonyFacet = ProjectFacetsManager.getProjectFacet(SymfonyFacetConstants.SYMFONY_COMPONENT);
// install the fixed facets
switch (symfonyVersion) {
case Symfony2_1_9:
facetedProject.installProjectFacet(
symfonyFacet.getVersion(SymfonyFacetConstants.SYMFONY_COMPONENT_VERSION_2_1), symfonyFacet,
monitor);
break;
case Symfony2_2_1:
facetedProject.installProjectFacet(
symfonyFacet.getVersion(SymfonyFacetConstants.SYMFONY_COMPONENT_VERSION_2_2), symfonyFacet,
monitor);
break;
default:
break;
}