コード例 #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);
 }
コード例 #11
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();
    }
  }
コード例 #12
0
  @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();
 }
コード例 #16
0
 public void disposeUIResources() {
   super.disposeUIResources();
   for (WizardMode mode : myModes) {
     Disposer.dispose(mode);
   }
 }