Exemplo n.º 1
0
  public static List<Module> createFromWizard(Project project, AbstractProjectWizard wizard) {
    if (project == null && wizard.getStepCount() > 0) {
      Project newProject = NewProjectUtil.createFromWizard(wizard, null);
      return newProject == null
          ? Collections.<Module>emptyList()
          : Arrays.asList(ModuleManager.getInstance(newProject).getModules());
    }

    final ProjectBuilder projectBuilder = wizard.getProjectBuilder();
    try {
      if (wizard.getStepCount() > 0) {
        Module module = new NewModuleAction().createModuleFromWizard(project, null, wizard);
        return Collections.singletonList(module);
      } else {
        return projectBuilder.commit(project);
      }
    } finally {
      if (projectBuilder != null) {
        projectBuilder.cleanup();
      }
    }
  }