Package org.eclipse.wst.common.project.facet.core

Examples of org.eclipse.wst.common.project.facet.core.IProjectFacet


  public static boolean isFacetedProject(IProject project) {
    try {
      final IFacetedProject faceted = ProjectFacetsManager
          .create(project);
      if (faceted != null) {
        IProjectFacet coreFacet = ProjectFacetsManager
            .getProjectFacet(PHPFacetsConstants.PHP_CORE_COMPONENT);
        IProjectFacet phpFacet = ProjectFacetsManager
            .getProjectFacet(PHPFacetsConstants.PHP_COMPONENT);
        if (faceted.hasProjectFacet(coreFacet)
            && faceted.hasProjectFacet(phpFacet)) {
          return true;
        }
View Full Code Here


  public static PHPVersion getPhpVersionFromFacets(IProject project) {
    try {
      final IFacetedProject faceted = ProjectFacetsManager
          .create(project);
      if (faceted != null) {
        IProjectFacet phpFacet = ProjectFacetsManager
            .getProjectFacet(PHPFacetsConstants.PHP_COMPONENT);
        final IProjectFacetVersion version = faceted
            .getInstalledVersion(phpFacet);
        if (PHPFacetsConstants.PHP_COMPONENT_VERSION_4.equals(version
            .getVersionString())) {
View Full Code Here

   * @param version
   *            php version
   * @return the php facets version
   */
  public static IProjectFacetVersion convertToFacetVersion(PHPVersion version) {
    IProjectFacet phpFacet = ProjectFacetsManager
        .getProjectFacet(PHPFacetsConstants.PHP_COMPONENT);
    switch (version) {
    case PHP4:
      return phpFacet
          .getVersion(PHPFacetsConstants.PHP_COMPONENT_VERSION_4);
    case PHP5:
      return phpFacet
          .getVersion(PHPFacetsConstants.PHP_COMPONENT_VERSION_5);
    case PHP5_3:
      return phpFacet
          .getVersion(PHPFacetsConstants.PHP_COMPONENT_VERSION_5_3);
    case PHP5_4:
    default:
      return phpFacet
          .getVersion(PHPFacetsConstants.PHP_COMPONENT_VERSION_5_4);
    }
  }
View Full Code Here

    // set the fixed facets (they will not be removable by the user)
    // the php.component facet will be set to the correct version
    // programmatically
    final Set<IProjectFacet> fixedFacets = new HashSet<IProjectFacet>();
    IProjectFacet coreFacet = ProjectFacetsManager
        .getProjectFacet(PHPFacetsConstants.PHP_CORE_COMPONENT);
    fixedFacets.add(coreFacet);
    IProjectFacet phpFacet = ProjectFacetsManager
        .getProjectFacet(PHPFacetsConstants.PHP_COMPONENT);
    fixedFacets.add(phpFacet);
    facetedProject.setFixedProjectFacets(fixedFacets);

    // install the fixed facets
View Full Code Here

   * Returns the faceted version of the core facet
   *
   * @return core facet
   */
  public static IProjectFacetVersion getCoreVersion() {
    IProjectFacet coreFacet = ProjectFacetsManager
        .getProjectFacet(PHPFacetsConstants.PHP_CORE_COMPONENT);
    return coreFacet.getDefaultVersion();
  }
View Full Code Here

      }

      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;
      }
View Full Code Here

     
      if (monitor == null) {
        monitor = new NullProgressMonitor();
      }
     
      IProjectFacet symfonyFacet = ProjectFacetsManager.getProjectFacet(SymfonyFacetConstants.SYMFONY_COMPONENT);
      Set<IFacetedProject> facetedProjects = ProjectFacetsManager.getFacetedProjects();
     
      for (IFacetedProject fp: facetedProjects) {
        if (project.getName().equals(fp.getProject().getName()) && fp.hasProjectFacet(symfonyFacet)) {
          if (fp.hasProjectFacet(symfonyFacet.getVersion(SymfonyFacetConstants.SYMFONY_COMPONENT_VERSION_2_1))) {
            fp.uninstallProjectFacet(symfonyFacet.getVersion(SymfonyFacetConstants.SYMFONY_COMPONENT_VERSION_2_1), symfonyFacet, monitor);
          } else if (fp.hasProjectFacet(symfonyFacet.getVersion(SymfonyFacetConstants.SYMFONY_COMPONENT_VERSION_2_2))) {
            fp.uninstallProjectFacet(symfonyFacet.getVersion(SymfonyFacetConstants.SYMFONY_COMPONENT_VERSION_2_2), symfonyFacet, monitor);     
          }
          break;
        }
      }
    } catch (CoreException ex) {
View Full Code Here

TOP

Related Classes of org.eclipse.wst.common.project.facet.core.IProjectFacet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.