コード例 #1
0
  private void initModuleWizard(
      final Project project,
      final ModulesProvider modulesProvider,
      @Nullable final String defaultPath) {
    myWizardContext = new WizardContext(project);
    if (defaultPath != null) {
      myWizardContext.setProjectFileDirectory(defaultPath);
      myWizardContext.setProjectName(
          defaultPath.substring(
              FileUtil.toSystemIndependentName(defaultPath).lastIndexOf("/") + 1));
    }
    myWizardContext.addContextListener(
        new WizardContext.Listener() {
          public void buttonsUpdateRequested() {
            updateButtons();
          }

          public void nextStepRequested() {
            doNextAction();
          }
        });

    myRootStep =
        new ProjectCreateModeStep(defaultPath, myWizardContext) {
          protected void update() {
            updateButtons();
          }
        };
    addStep(myRootStep);
    for (WizardMode mode : myRootStep.getModes()) {
      appendSteps(mode.getSteps(myWizardContext, modulesProvider));
    }
    init();
  }
コード例 #2
0
  @Override
  public void updateDataModel() {

    myWizardContext.setProjectBuilder(myModuleBuilder);
    myWizardContext.setProjectName(myNamePathComponent.getNameValue());
    myWizardContext.setProjectFileDirectory(myNamePathComponent.getPath());
    myFormatPanel.updateData(myWizardContext);

    if (myModuleBuilder != null) {
      final String moduleName = getModuleName();
      myModuleBuilder.setName(moduleName);
      myModuleBuilder.setModuleFilePath(
          FileUtil.toSystemIndependentName(myModuleFileLocation.getText())
              + "/"
              + moduleName
              + ModuleFileType.DOT_DEFAULT_EXTENSION);
      myModuleBuilder.setContentEntryPath(FileUtil.toSystemIndependentName(getModuleContentRoot()));
      if (myModuleBuilder instanceof TemplateModuleBuilder) {
        myWizardContext.setProjectStorageFormat(StorageScheme.DIRECTORY_BASED);
      }
    }

    if (mySettingsStep != null) {
      mySettingsStep.updateDataModel();
    }
  }
 /**
  * Applies external system-specific settings like project files location etc to the given context.
  *
  * @param context storage for the project/module settings.
  */
 public void applyProjectSettings(@NotNull WizardContext context) {
   if (myExternalProjectNode == null) {
     assert false;
     return;
   }
   context.setProjectName(myExternalProjectNode.getData().getName());
   context.setProjectFileDirectory(
       myExternalProjectNode.getData().getIdeProjectFileDirectoryPath());
   applyExtraSettings(context);
 }