Ejemplo n.º 1
0
  /** @since 4.0 */
  private void validatePage() {
    final IContainer folder;
    try {
      folder =
          WizardUtil.validateFileAndFolder(
              this.nameText, this.folderText, this.mainPage, ModelerCore.VDB_FILE_EXTENSION, false);
      if (this.mainPage.getMessageType() == IMessageProvider.ERROR) {
        // WizardUtil.validateFileAndFolder can set error message and message type so no need to do
        // further
        // validation if an error was already found (JBEDSP-588)
        return;
      }

      IStatus status = projectValidator.validate(new Object[] {folder});
      String proposedName = this.nameText.getText();

      if (!status.isOK()) {
        // only update the message if the vFolder is non-null;
        // if WizardUtil returned null, it already set the status
        // this corrects the case where the wrong message shows for
        // a bad filename.
        if (folder != null) {
          this.mainPage.setErrorMessage(status.getMessage());
          this.mainPage.setPageComplete(false);
        } // endif
      } else if (!nameValidator.isValidName(proposedName)) {
        this.mainPage.setErrorMessage(VDB_NAME_ERROR);
        this.mainPage.setPageComplete(false);
      } else if (ModelUtilities.vdbNameReservedValidation(proposedName) != null) {
        this.mainPage.setErrorMessage(ModelUtilities.vdbNameReservedValidation(proposedName));
        this.mainPage.setPageComplete(false);
      } else {
        this.mainPage.setErrorMessage(null);
        this.mainPage.setPageComplete(true);
      }

      if (this.mainPage.isPageComplete()) {
        this.name = proposedName;
        this.folder = folder;
      }
    } catch (final CoreException err) {
      VdbUiConstants.Util.log(err);
      WizardUtil.setPageComplete(this.mainPage, err.getLocalizedMessage(), IMessageProvider.ERROR);
    }
  }
 private void setThisPageComplete(String message, int severity) {
   WizardUtil.setPageComplete(this, message, severity);
 }