use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project sling by apache.
the class ProjectAdapter method installFacet.
public void installFacet(String facetId, String facetVersion) throws CoreException {
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
IProjectFacet slingBundleFacet = ProjectFacetsManager.getProjectFacet(facetId);
IProjectFacetVersion projectFacetVersion = slingBundleFacet.getVersion(facetVersion);
facetedProject.installProjectFacet(projectFacetVersion, null, new NullProgressMonitor());
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project sling by apache.
the class FacetHelper method containsFacet.
/**
* Checks if the specified project has the specified facet
*
* @param project the project, may be <code>null</code>
* @param facetId the facet to check for
* @return true if the specified <tt>project</tt> has the specified <tt>facetId</tt>
*/
public static boolean containsFacet(IProject project, String facetId) {
if (project == null) {
return false;
}
IFacetedProject facetedProject = (IFacetedProject) project.getAdapter(IFacetedProject.class);
if (facetedProject == null) {
return false;
}
IProjectFacet facet = ProjectFacetsManager.getProjectFacet(facetId);
return facetedProject.hasProjectFacet(facet);
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project sling by apache.
the class ConfigurationHelper method convertToContentPackageProject.
public static void convertToContentPackageProject(IProject project, IProgressMonitor monitor, IPath contentSyncRoot) throws CoreException {
IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, null);
// install content facet
IProjectFacet slingContentFacet = ProjectFacetsManager.getProjectFacet("sling.content");
facetedProject.installProjectFacet(slingContentFacet.getLatestVersion(), null, null);
ProjectUtil.setSyncDirectoryPath(project, contentSyncRoot);
// also install sightly facet 1.1 by default
IProjectFacet sightlyFacet = ProjectFacetsManager.getProjectFacet("sightly");
if (sightlyFacet != null) {
facetedProject.installProjectFacet(sightlyFacet.getLatestVersion(), null, null);
}
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project webtools.sourceediting by eclipse.
the class ConvertJob method runInWorkspace.
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(JSDT_FACET);
IFacetedProject facetedProject = ProjectFacetsManager.create(fProject);
if (facetedProject != null && fProject.isAccessible()) {
if (fInstall) {
IProjectFacetVersion latestVersion = projectFacet.getLatestVersion();
facetedProject.installProjectFacet(latestVersion, null, monitor);
}
if (fUseExplicitWorkingCopy) {
IFacetedProjectWorkingCopy copy = facetedProject.createWorkingCopy();
Set fixed = new HashSet(facetedProject.getFixedProjectFacets());
fixed.add(projectFacet);
copy.setFixedProjectFacets(fixed);
copy.commitChanges(new NullProgressMonitor());
copy.dispose();
} else {
Set fixed = new HashSet(facetedProject.getFixedProjectFacets());
if (!fixed.contains(projectFacet)) {
fixed.add(projectFacet);
facetedProject.setFixedProjectFacets(fixed);
}
}
}
} catch (IllegalArgumentException e) {
// unknown facet ID, bad installation configuration?
} catch (Exception e) {
Logger.logException(e);
}
return Status.OK_STATUS;
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project webtools.sourceediting by eclipse.
the class FacetModuleCoreSupportDelegate method isWebFragmentProject.
/**
* @param project
* @return
* @throws CoreException
*/
static boolean isWebFragmentProject(IProject project) {
if (project == null)
return false;
try {
if (ProjectFacetsManager.isProjectFacetDefined(JST_WEBFRAGMENT_MODULE)) {
IFacetedProject faceted = ProjectFacetsManager.create(project);
IProjectFacet webModuleFacet = ProjectFacetsManager.getProjectFacet(JST_WEBFRAGMENT_MODULE);
if (faceted != null && faceted.hasProjectFacet(webModuleFacet)) {
return true;
}
}
} catch (CoreException e) {
Logger.logException(e);
}
return false;
}
Aggregations