@SuppressWarnings("restriction")
  @Override
  public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor)
      throws CoreException {

    markerManager.deleteMarkers(request.getProject(), MISSING_ENDORSED_DIRS_MARKER);

    IMavenProjectFacade mavenProjectFacade = request.getMavenProjectFacade();
    File[] endorsedDirs = getEndorsedDirs(mavenProjectFacade, monitor);
    if (endorsedDirs == null || endorsedDirs.length == 0) {
      return;
    }

    Set<File> missingEndorsedDir = checkMissingDirs(endorsedDirs);
    if (!missingEndorsedDir.isEmpty()) {
      MojoExecutionKey key =
          new MojoExecutionKey(
              "org.apache.maven.plugins", "maven-compiler-plugin", null, null, null, null);
      SourceLocation sourceLocation =
          SourceLocationHelper.findLocation(mavenProjectFacade.getMavenProject(), key);
      for (File dir : missingEndorsedDir) {
        addMissingDirWarning(request.getProject(), sourceLocation, dir);
      }
    }
  }
  public void configureRawClasspath(
      ProjectConfigurationRequest request, IClasspathDescriptor classpath, IProgressMonitor monitor)
      throws CoreException {

    IJavaProject javaProject = JavaCore.create(request.getProject());
    if (javaProject == null) {
      return;
    }

    File[] endorsedDirs = getEndorsedDirs(request.getMavenProjectFacade(), monitor);

    if (endorsedDirs == null || endorsedDirs.length == 0) {
      ClasspathHelpers.removeEndorsedLibClasspathContainer(classpath);
      return;
    }

    getEndorsedLibrariesManager()
        .configureEndorsedLibs(javaProject, classpath, endorsedDirs, monitor);
  }
  @Override
  public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor)
      throws CoreException {
    final MavenProject mavenProject = request.getMavenProject();
    final Plugin liferayMavenPlugin = LiferayMavenUtil.getLiferayMavenPlugin(mavenProject);

    if (!shouldConfigure(liferayMavenPlugin)) {
      return;
    }

    final IProject project = request.getProject();
    final IFile pomFile = project.getFile(IMavenConstants.POM_FILE_NAME);
    final IFacetedProject facetedProject = ProjectFacetsManager.create(project, false, monitor);

    removeLiferayMavenMarkers(project);

    final List<MavenProblemInfo> errors = findLiferayMavenPluginProblems(project, mavenProject);

    if (errors.size() > 0) {
      try {
        this.markerManager.addErrorMarkers(
            pomFile, ILiferayMavenConstants.LIFERAY_MAVEN_MARKER_CONFIGURATION_ERROR_ID, errors);
      } catch (CoreException e) {
        // no need to log this error its just best effort
      }

      return;
    }

    if (shouldInstallNewLiferayFacet(facetedProject)) {
      final MavenProblemInfo installProblem =
          installNewLiferayFacet(facetedProject, mavenProject, monitor);

      if (installProblem != null) {
        this.markerManager.addMarker(
            pomFile,
            ILiferayMavenConstants.LIFERAY_MAVEN_MARKER_CONFIGURATION_ERROR_ID,
            installProblem.getMessage(),
            installProblem.getLocation().getLineNumber(),
            IMarker.SEVERITY_WARNING);
      }
    }
  }
  @Override
  public void configure(final ProjectConfigurationRequest request, final IProgressMonitor monitor)
      throws CoreException {

    final MavenProject mavenProject = request.getMavenProject();
    if (mavenProject == null) {
      return;
    }

    final MavenPluginWrapper pluginWrapper =
        this.getMavenPlugin(monitor, request.getMavenProjectFacade());
    final IProject project = request.getProject();

    if (!pluginWrapper.isPluginConfigured()) {
      return;
    }

    this.handleProjectConfigurationChange(
        request.getMavenSession(),
        request.getMavenProjectFacade(),
        project,
        monitor,
        pluginWrapper);
  }
  @Override
  public void configure(ProjectConfigurationRequest projectConfig, IProgressMonitor monitor)
      throws CoreException {

    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean configureGWT = store.getBoolean(Activator.CONFIGURE_GWT);
    log.debug("GWT Entry Point Modules configuration is {}", configureGWT ? "enabled" : "disabled");
    if (configureGWT
        && projectConfig.getMavenProject().getPlugin(GWT_WAR_MAVEN_PLUGIN_KEY) != null) {
      String projectName = projectConfig.getProject().getName();
      IJavaProject javaProject = JavaCore.create(projectConfig.getProject());
      if (javaProject != null) {
        log.debug("Configure Entry Point Modules for GWT Project {}", projectName);

        Plugin pluginConfig = projectConfig.getMavenProject().getPlugin(GWT_WAR_MAVEN_PLUGIN_KEY);

        List<String> modNames = findModules(pluginConfig, javaProject);

        try {
          GWTProjectProperties.setEntryPointModules(projectConfig.getProject(), modNames);
        } catch (BackingStoreException e) {
          logError("Exception in Maven GWT Configurator, cannot set entry point modules", e);
        }

        log.debug("Configure Output location for GWT Project {}", projectName);
        try {
          IPath webContentPath = ProjectHome.getFirstWebContentPath(projectConfig.getProject());
          if (webContentPath != null) {
            IFolder outputWorkspaceFolder =
                projectConfig.getProject().getWorkspace().getRoot().getFolder(webContentPath);
            WebAppProjectProperties.setLastUsedWarOutLocation(
                projectConfig.getProject(), outputWorkspaceFolder.getFullPath());
          }
        } catch (BackingStoreException e) {
          logError("Exception in Maven GWT Configurator, cannot set war output location", e);
        }

      } else {
        log.debug("Skip configurator for non Java project {}", projectName);
      }
    }
  }
 public void unconfigure(ProjectConfigurationRequest request, IProgressMonitor monitor)
     throws CoreException {
   super.unconfigure(request, monitor);
   ClasspathHelpers.removeEndorsedLibClasspathContainer(request.getProject());
 }