@Override
  public void mavenProjectChanged(
      final MavenProjectChangedEvent mavenProjectChangedEvent, final IProgressMonitor monitor)
      throws CoreException {
    final IMavenProjectFacade mavenProjectFacade = mavenProjectChangedEvent.getMavenProject();

    if (mavenProjectFacade != null) {
      final MavenProject mavenProject = mavenProjectFacade.getMavenProject();
      if (mavenProject == null) {
        return;
      }
      final MavenPluginWrapper pluginWrapper = this.getMavenPlugin(monitor, mavenProjectFacade);
      final IProject project = mavenProjectFacade.getProject();
      if (this.checkUnconfigurationRequired(
          monitor, mavenProjectFacade, mavenProjectChangedEvent.getOldMavenProject())) {
        this.unconfigureEclipsePlugin(project, monitor);
        return;
      }
      if (pluginWrapper.isPluginConfigured()) {
        // only call handler if maven plugin is configured or found.
        // we need a session.
        MavenExecutionRequest request = maven.createExecutionRequest(monitor);
        MavenSession session = maven.createSession(request, mavenProject);
        this.handleProjectConfigurationChange(
            session, mavenProjectFacade, project, monitor, pluginWrapper);
      } else {
        // TODO: redirect to eclipse logger.
        // this.console.logMessage(String.format(
        // "Will not configure the Eclipse Plugin for Maven Plugin [%s:%s],"
        // +
        // "(Could not find maven plugin instance or configuration in pom)",
        // this.getMavenPluginGroupId(),
        // this.getMavenPluginArtifactId()));
      }
    }
    super.mavenProjectChanged(mavenProjectChangedEvent, monitor);
  }
コード例 #2
0
 public void unconfigure(ProjectConfigurationRequest request, IProgressMonitor monitor)
     throws CoreException {
   super.unconfigure(request, monitor);
   ClasspathHelpers.removeEndorsedLibClasspathContainer(request.getProject());
 }