コード例 #1
0
  public String getErrorMessage() {
    if (copyNetteCheckbox.isSelected()) {
      Validable emptyPathValidator = new NetteEmptyPathValidator();

      if (emptyPathValidator.validate(NetteOptions.getInstance().getNettePath())) {
        return NbBundle.getMessage(NewNetteProjectPanel.class, "ERR_no_nette_directory");
      }

      Validable loaderPathValidator = new NetteLoaderPathValidator();

      if (!loaderPathValidator.validate(NetteOptions.getInstance().getNettePath())) {
        return NbBundle.getMessage(NewNetteProjectPanel.class, "ERR_no_nette_files");
      }
    }

    return null;
  }
コード例 #2
0
  private void doEnablement() {
    Validable classNameValidator = new NetteClassNameValidator();
    Validable componentNameValidator = new NetteComponentNameValidator();

    if (isFormTabSelected()) {
      if (!classNameValidator.validate(getFormClass())) {
        errorLabel.setIcon(errorIcon);
        setWarningText(
            NbBundle.getMessage(CreateComponentGeneratorPanel.class, "ERR_head_form_class"));

        dd.setValid(false);
      } else if (!componentNameValidator.validate(getFormName())) {
        errorLabel.setIcon(errorIcon);
        setWarningText(
            NbBundle.getMessage(CreateComponentGeneratorPanel.class, "ERR_head_form_name"));

        dd.setValid(false);
      } else {
        errorLabel.setIcon(null);
        errorLabel.setText("");

        dd.setValid(true);
      }
    } else {
      if (!classNameValidator.validate(getComponentClass())) {
        errorLabel.setIcon(errorIcon);
        setWarningText(
            NbBundle.getMessage(CreateComponentGeneratorPanel.class, "ERR_head_component_class"));

        dd.setValid(false);
      } else if (!componentNameValidator.validate(getComponentName())) {
        errorLabel.setIcon(errorIcon);
        setWarningText(
            NbBundle.getMessage(CreateComponentGeneratorPanel.class, "ERR_head_component_name"));

        dd.setValid(false);
      } else {
        errorLabel.setIcon(null);
        errorLabel.setText("");

        dd.setValid(true);
      }
    }
  }