protected final void doOKAction() {
   int idx = getCurrentStep();
   try {
     do {
       final ModuleWizardStep step = mySteps.get(idx);
       if (step != getCurrentStepObject()) {
         step.updateStep();
       }
       if (!commitStepData(step)) {
         return;
       }
       step.onStepLeaving();
       try {
         step._commit(true);
       } catch (CommitStepException e) {
         String message = e.getMessage();
         if (message != null) {
           Messages.showErrorDialog(getCurrentStepComponent(), message);
         }
         return;
       }
       if (!isLastStep(idx)) {
         idx = getNextStep(idx);
       } else {
         break;
       }
     } while (true);
   } finally {
     myCurrentStep = idx;
     updateStep();
   }
   super.doOKAction();
 }
 protected String getHelpID() {
   ModuleWizardStep step = getCurrentStepObject();
   if (step != null) {
     return step.getHelpId();
   }
   return null;
 }
  protected void updateStep() {
    final ModuleWizardStep currentStep = getCurrentStepObject();
    currentStep.updateStep();

    super.updateStep();

    updateButtons();

    final JButton nextButton = getNextButton();
    final JButton finishButton = getFinishButton();
    final boolean isLastStep = isLastStep(getCurrentStep());

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            if (!isShowing()) {
              return;
            }
            final JComponent preferredFocusedComponent = currentStep.getPreferredFocusedComponent();
            if (preferredFocusedComponent != null) {
              preferredFocusedComponent.requestFocus();
            } else {
              if (isLastStep) {
                finishButton.requestFocus();
              } else {
                nextButton.requestFocus();
              }
            }
            getRootPane().setDefaultButton(isLastStep ? finishButton : nextButton);
          }
        });
  }
Example #4
0
 @Override
 public boolean validate() throws ConfigurationException {
   if (mySettingsStep != null) {
     if (!mySettingsStep.validate()) return false;
   }
   ModuleWizardStep step = getCustomStep();
   return step != null ? step.validate() : super.validate();
 }
 protected void doNextAction() {
   final ModuleWizardStep step = getCurrentStepObject();
   if (!commitStepData(step)) {
     return;
   }
   step.onStepLeaving();
   super.doNextAction();
 }
 protected final int getPreviousStep(final int step) {
   ModuleWizardStep previousStep = null;
   final StepSequence stepSequence = getMode().getSteps(myWizardContext, null);
   if (stepSequence != null) {
     previousStep = stepSequence.getPreviousStep(mySteps.get(step));
     while (previousStep != null && !previousStep.isStepVisible()) {
       previousStep = stepSequence.getPreviousStep(previousStep);
     }
   }
   return previousStep == null ? 0 : mySteps.indexOf(previousStep);
 }
Example #7
0
 @Override
 public void updateDataModel() {
   ModuleBuilder builder = getSelectedBuilder();
   myWizard.getSequence().addStepsForBuilder(builder, myContext, myModulesProvider);
   ModuleWizardStep step = getCustomStep();
   if (step != null) {
     step.updateDataModel();
   }
   if (mySettingsStep != null) {
     mySettingsStep.updateDataModel();
   }
 }
Example #8
0
 private boolean showCustomOptions(@NotNull ModuleBuilder builder) {
   String card = builder.getBuilderId();
   if (!myCustomSteps.containsKey(card)) {
     ModuleWizardStep step = builder.getCustomOptionsStep(myContext, this);
     if (step == null) return false;
     step.updateStep();
     myCustomSteps.put(card, step);
     myOptionsPanel.add(step.getComponent(), card);
   }
   showCard(card);
   return true;
 }
 private boolean commitStepData(final ModuleWizardStep step) {
   try {
     if (!step.validate()) {
       return false;
     }
   } catch (ConfigurationException e) {
     Messages.showErrorDialog(myCurrentProject, e.getMessage(), e.getTitle());
     return false;
   }
   step.updateDataModel();
   return true;
 }
 protected final int getNextStep(int step) {
   ModuleWizardStep nextStep = null;
   final StepSequence stepSequence = getMode().getSteps(myWizardContext, null);
   if (stepSequence != null) {
     if (myRootStep == mySteps.get(step)) {
       return mySteps.indexOf(stepSequence.getCommonSteps().get(0));
     }
     nextStep = stepSequence.getNextStep(mySteps.get(step));
     while (nextStep != null && !nextStep.isStepVisible()) {
       nextStep = stepSequence.getNextStep(nextStep);
     }
   }
   return nextStep == null ? step : mySteps.indexOf(nextStep);
 }
  @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();
    }
  }
  @Override
  public boolean validate() throws ConfigurationException {
    ProjectTemplate template = getSelectedTemplate();
    if (template == null) {
      throw new ConfigurationException(
          StringUtil.capitalize(
              ProjectBundle.message(
                  "project.new.wizard.from.template.error", myWizardContext.getPresentationName())),
          "Error");
    }

    if (myWizardContext.isCreatingNewProject()) {
      if (!myNamePathComponent.validateNameAndPath(myWizardContext, myFormatPanel.isDefault()))
        return false;
    }

    if (!validateModulePaths()) return false;
    if (!myWizardContext.isCreatingNewProject()) {
      validateExistingModuleName();
    }

    ValidationInfo info = template.validateSettings();
    if (info != null) {
      throw new ConfigurationException(info.message, "Error");
    }
    if (mySettingsStep != null) {
      return mySettingsStep.validate();
    }
    return true;
  }
 public void doCancelAction() {
   final ModuleWizardStep step = getCurrentStepObject();
   step.onStepLeaving();
   super.doCancelAction();
 }
 protected void doPreviousAction() {
   final ModuleWizardStep step = getCurrentStepObject();
   step.onStepLeaving();
   super.doPreviousAction();
 }
 protected void dispose() {
   for (ModuleWizardStep step : mySteps) {
     step.disposeUIResources();
   }
   super.dispose();
 }
 public void disposeUIResources() {
   super.disposeUIResources();
   for (WizardMode mode : myModes) {
     Disposer.dispose(mode);
   }
 }