コード例 #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 mavenProjectChanged(MavenProjectChangedEvent event, IProgressMonitor monitor)
     throws CoreException {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   boolean configureGWT = store.getBoolean(Activator.CONFIGURE_GWT);
   if (configureGWT) {
     Plugin newConfig =
         event.getMavenProject().getMavenProject().getPlugin(GWT_WAR_MAVEN_PLUGIN_KEY);
     if (newConfig != null) {
       IJavaProject javaProject = JavaCore.create(event.getMavenProject().getProject());
       if (javaProject.exists()) {
         List<String> modNames = findModules(newConfig, javaProject);
         try {
           GWTProjectProperties.setEntryPointModules(
               event.getMavenProject().getProject(), modNames);
         } catch (BackingStoreException e) {
           logError("Exception in Maven GWT Configurator, cannot set entry point modules", e);
         }
       }
     }
   }
 }