private boolean initModules(IResource selection) {
    // If the selection was module file, use that as the default
    if (ModuleUtils.isModuleXml(selection)) {
      ModuleFile module = ModuleUtils.create((IFile) selection);
      List<String> moduleNames = Arrays.asList(new String[] {module.getQualifiedName()});
      modulesBlock.setModules(moduleNames);
    } else {
      // Otherwise, include all modules in the project
      modulesBlock.setModules(GWTProjectProperties.getEntryPointModules(hostPageProject));
    }

    modulesBlock.setDefaultModules(GWTProjectProperties.getEntryPointModules(hostPageProject));

    return true;
  }
  private IStatus validateModules() {
    updateModulesIfProjectChanged();

    if (modulesBlock.getModules().isEmpty()) {
      return StatusUtilities.newErrorStatus("Add one or more modules", GWTPlugin.PLUGIN_ID);
    }

    return StatusUtilities.OK_STATUS;
  }
  public List<ModuleFile> getModules() {
    List<ModuleFile> modules = new ArrayList<ModuleFile>();

    // Convert fully-qualified module names into actual ModuleFile's
    for (String moduleName : modulesBlock.getModules()) {
      ModuleFile module = (ModuleFile) ModuleUtils.findModule(getJavaProject(), moduleName, false);
      if (module != null) {
        modules.add(module);
      }
    }

    return modules;
  }
  private void updateModulesIfProjectChanged() {
    if (hostPageProject != null) {
      if (hostPageProject != null && !getJavaProject().equals(modulesBlock.getJavaProject())) {
        // Set the project for the block (needed for adding a module)
        modulesBlock.setJavaProject(getJavaProject());

        // Set the default and initially-selected modules for the block.
        modulesBlock.setDefaultModules(GWTProjectProperties.getEntryPointModules(hostPageProject));
        modulesBlock.setModules(GWTProjectProperties.getEntryPointModules(hostPageProject));
      }
    } else {
      modulesBlock.setJavaProject(null);
      modulesBlock.setDefaultModules(Collections.<String>emptyList());
      modulesBlock.setModules(Collections.<String>emptyList());
    }
  }
 private void createModulesComponent(Composite parent, int columns) {
   modulesBlock.doFillIntoGrid(parent, columns);
 }