コード例 #1
0
  @Nullable
  ProjectBuilder runModuleWizard(Component dialogParent, boolean anImport) {
    AbstractProjectWizard wizard;
    if (anImport) {
      wizard = ImportModuleAction.selectFileAndCreateWizard(myProject, dialogParent);
      if (wizard == null) return null;
      if (wizard.getStepCount() == 0) {
        ProjectBuilder builder = wizard.getProjectBuilder();
        Disposer.dispose(wizard.getDisposable());
        return builder;
      }
    } else {
      wizard = new NewProjectWizard(myProject, dialogParent, this);
    }
    if (wizard.showAndGet()) {
      final ProjectBuilder builder = wizard.getProjectBuilder();
      if (builder instanceof ModuleBuilder) {
        final ModuleBuilder moduleBuilder = (ModuleBuilder) builder;
        if (moduleBuilder.getName() == null) {
          moduleBuilder.setName(wizard.getProjectName());
        }
        if (moduleBuilder.getModuleFilePath() == null) {
          moduleBuilder.setModuleFilePath(wizard.getModuleFilePath());
        }
      }
      if (!builder.validate(myProject, myProject)) {
        return null;
      }
      return wizard.getProjectBuilder();
    }

    return null;
  }
コード例 #2
0
  public void updateDataModel() {

    if (!isCreateFromTemplateMode()) {
      mySequence.setType(myCreateModuleCb.isSelected() ? getSelectedBuilderId() : null);
    }
    super.updateDataModel();

    if (!isCreateFromTemplateMode() && myCreateModuleCb.isSelected()) {
      final ModuleBuilder builder = (ModuleBuilder) myMode.getModuleBuilder();
      assert builder != null;
      final String moduleName = getModuleName();
      builder.setName(moduleName);
      builder.setModuleFilePath(
          FileUtil.toSystemIndependentName(myModuleFileLocation.getText())
              + "/"
              + moduleName
              + ModuleFileType.DOT_DEFAULT_EXTENSION);
      builder.setContentEntryPath(FileUtil.toSystemIndependentName(myModuleContentRoot.getText()));
    }
  }