예제 #1
0
 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();
 }
예제 #2
0
 protected String getHelpID() {
   ModuleWizardStep step = getCurrentStepObject();
   if (step != null) {
     return step.getHelpId();
   }
   return null;
 }
예제 #3
0
  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);
          }
        });
  }
예제 #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();
 }
예제 #5
0
 protected void doNextAction() {
   final ModuleWizardStep step = getCurrentStepObject();
   if (!commitStepData(step)) {
     return;
   }
   step.onStepLeaving();
   super.doNextAction();
 }
예제 #6
0
 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);
 }
예제 #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();
   }
 }
예제 #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;
 }
예제 #9
0
 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;
 }
예제 #10
0
 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;
  }
예제 #13
0
 public void doCancelAction() {
   final ModuleWizardStep step = getCurrentStepObject();
   step.onStepLeaving();
   super.doCancelAction();
 }
예제 #14
0
 protected void doPreviousAction() {
   final ModuleWizardStep step = getCurrentStepObject();
   step.onStepLeaving();
   super.doPreviousAction();
 }
예제 #15
0
 protected void dispose() {
   for (ModuleWizardStep step : mySteps) {
     step.disposeUIResources();
   }
   super.dispose();
 }
 public void disposeUIResources() {
   super.disposeUIResources();
   for (WizardMode mode : myModes) {
     Disposer.dispose(mode);
   }
 }