コード例 #1
0
  @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);
      }
    }
  }
コード例 #2
0
  @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);
  }