@Override public IValidationStatus validate() { IValidationStatus locationStatus = validateLocation(); if (locationStatus.hasErrors()) { return locationStatus; } IValidationStatus templateStatus = validateTemplate(); if (locationStatus.hasErrors()) { return locationStatus; } // if (!validateTableName()) { // return false; // } return ValidationStatus.getValidationStatus(locationStatus, templateStatus); }
public IValidationStatus validateLocation() { IValidationStatus status; try { status = validateLocationGeneric(); if (status.hasErrors()) { return status; } IPath location = new Path(getTargetLocation()).append(getFileName()); // TODO - more precise test for the location ../WebContent/... if (location.toString().indexOf(ICommonConstants.ARTIFACT_TYPE.SCRIPTING_SERVICES) == -1) { return ValidationStatus.createError(TARGET_LOCATION_IS_NOT_ALLOWED); } } catch (Exception e) { // temp workaround due to another bug - context menu is not context // aware => target location and name are null (in the first page of // the wizard) return ValidationStatus.createError(""); // $NON-NLS-1$ } return status; }
@Override protected void checkPageStatus() { if (getModel().getTargetLocation() == null || "".equals(getModel().getTargetLocation())) { // $NON-NLS-1$ setPageComplete(false); return; } if (getModel().getFileName() == null || "".equals(getModel().getFileName())) { // $NON-NLS-1$ setPageComplete(false); return; } IValidationStatus status = model.validateLocation(); if (status.hasErrors()) { setErrorMessage(status.getMessage()); setPageComplete(false); } else if (status.hasWarnings()) { setErrorMessage(status.getMessage()); setPageComplete(true); } else { setErrorMessage(null); setPageComplete(true); } }