@Override @Nullable protected ValidationInfo doValidate() { try { minLength.validateValue(); maxLength.validateValue(); lengthRange.validate(); } catch (final ValidationException e) { return new ValidationInfo(e.getMessage(), e.getComponent()); } if (alphabetList.getSelectedValuesList().isEmpty()) { return new ValidationInfo("Please select at least one option.", alphabetList); } return null; }
@Override @Nullable protected ValidationInfo doValidate() { try { if (dictionaries.getActiveEntries().isEmpty()) { throw new ValidationException("Select at least one dictionary.", dictionaries); } minLength.validateValue(); maxLength.validateValue(); lengthRange.validate(); } catch (final ValidationException e) { return new ValidationInfo(e.getMessage(), e.getComponent()); } return null; }
public ValidationInfo doValidate() { if (tfName.getText().trim().isEmpty()) { return new ValidationInfo(Localizer.get("warning.FillEmptyFields"), tfName); } if (cbDeepLimit.isSelected()) { try { int testValue = (Integer) spnDeepLimit.getValue(); } catch (Exception e) { Logger.log("collectData spnDeepLimit.getValue: " + e.getMessage()); Logger.printStack(e); return new ValidationInfo(Localizer.get("warning.InvalidNumber"), tfName); } } return null; }
@Override protected ValidationInfo doValidate() { if (wrappers.isEmpty()) { return new ValidationInfo(Localizer.get("warning.CreateAtLeastOneAction"), actionsPanel); } for (SearchActionWrapper wrapper : wrappers) { ValidationInfo validationInfo = wrapper.doValidate(); if (validationInfo != null) { return validationInfo; } } SearchActionType lastActionType = wrappers.get(wrappers.size() - 1).getAction().getActionType(); if (returnFile) { switch (lastActionType) { case DIR_ABOVE: case DIR_BELOW: return new ValidationInfo(Localizer.get("warning.LastActionShouldSearchFile"), actionsPanel); } } return null; }
@Override public ValidationInfo doValidate() { ValidationInfo result; result = TemplateValidator.validateProperties(ptWrapper); if (result != null) return result; if (ptWrapper.getMode() != PackageTemplateWrapper.ViewMode.EDIT || !ptWrapper.getPackageTemplate().getName().equals(ptWrapper.jtfName.getText())) { // if (!TemplateValidator.isPackageTemplateNameUnique(ptWrapper.jtfName.getText())) { // return new ValidationInfo(Localizer.get("warning.TemplateWithSpecifiedNameAlreadyExists"), ptWrapper.jtfName); // } result = TemplateValidator.validateProperties(ptWrapper); if (result != null) return result; } return null; }
@Override public ValidationInfo doValidate(String path, @Nullable JComponent component) { // ValidationInfo validationInfo = TemplateValidator.isTemplateValid((PackageTemplate) jbList.getSelectedValue()); // if (validationInfo != null) { // return new ValidationInfo(validationInfo.message, jbList); // } File file = new File(path); if (file.isDirectory()) { return new ValidationInfo(Localizer.get("warning.select.packageTemplate"), component); } PackageTemplate pt = PackageTemplateHelper.getPackageTemplate(file); if (pt == null) { return new ValidationInfo(Localizer.get("warning.select.packageTemplate"), component); } return null; }
@Override protected ValidationInfo doValidate() { // description String description = tfDescription.getText(); if (description == null || description.isEmpty()) { return new ValidationInfo(Localizer.get("warning.FillEmptyFields"), tfDescription); } if (textInjection.getCustomPath() == null) { return new ValidationInfo(Localizer.get("warning.ShouldCreateCustomPath"), panel); } // textToSearch String textToSearch = tfToSearch.getText(); if (textToSearch == null || textToSearch.isEmpty()) { return new ValidationInfo(Localizer.get("warning.FillEmptyFields"), tfToSearch); } // textToInject String textToInject = tfToInject.getText(); if (textToInject == null) { tfToInject.setText(""); } return null; }
@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 (!myModuleNameLocationComponent.validateModulePaths()) return false; if (!myWizardContext.isCreatingNewProject()) { myModuleNameLocationComponent.validateExistingModuleName(myWizardContext.getProject()); } ValidationInfo info = template.validateSettings(); if (info != null) { throw new ConfigurationException(info.message, "Error"); } if (mySettingsStep != null) { return mySettingsStep.validate(); } return true; }
@Override protected void doOKAction() { PasswordComponentBase component = getSelectedComponent(); if (component.apply()) { super.doOKAction(); } else { ValidationInfo info = component.validatePassword(); if (info != null) { setErrorText(info.message + " " + StringUtil.repeat(".", myRetriesCount)); if (info.component != null) { info.component.requestFocus(); } if (++myRetriesCount > NUMBER_OF_RETRIES) { super.doCancelAction(); } } } }
@Nullable @Override public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) { if (myTemplate == null) { return super.modifySettingsStep(settingsStep); } final WebProjectGenerator.GeneratorPeer peer = myTemplate.getPeer(); peer.buildUI(settingsStep); return new ModuleWizardStep() { @Override public JComponent getComponent() { return null; } @Override public void updateDataModel() { } @Override public boolean validate() throws ConfigurationException { ValidationInfo info = peer.validate(); if (info != null) throw new ConfigurationException(info.message); return true; } }; }
@Override protected ValidationInfo doValidate() { final String styleName = getStyleName(); if (styleName.length() == 0) { return new ValidationInfo("specify style name", myStyleNameField); } if (!AndroidResourceUtil.isCorrectAndroidResourceName(styleName)) { return new ValidationInfo("incorrect style name", myStyleNameField); } final Module module = getChosenModule(); if (module == null) { return new ValidationInfo("specify module", myModuleCombo); } return CreateXmlResourceDialog.checkIfResourceAlreadyExists(module, getStyleName(), ResourceType.STYLE, myDirNames, myFileName); }
@Nullable private ValidationInfo validateMinimumGradleVersion() { if (isNotEmpty(myMinimumGradleVersion)) { // When we reach this point we know the path entered is a valid Gradle home path. Now we need to verify the version of Gradle at that // location is equal or greater than the one in myMinimumGradleVersion. FullRevision minimum = PreciseRevision.parseRevision(myMinimumGradleVersion); File enteredGradleHomePath = getGradleHomePath(getEnteredGradleHomePath()); FullRevision gradleVersion = getGradleVersion(enteredGradleHomePath); if (gradleVersion == null) { return newPathIsInvalidInfo("Unable to detect Gradle version"); } if (minimum.compareTo(gradleVersion) > 0) { return newPathIsInvalidInfo(String.format("Gradle %1$s or newer is required", myMinimumGradleVersion)); } } return null; }
@Override @Nullable protected ValidationInfo doValidate() { int selectionCount = getModulesTable().getModel().selectedRowCount; if (selectionCount <= 0) { return new ValidationInfo("Please select at least one Module", myModulesTable); } if (myMaxSelectionCount > 0 && selectionCount > myMaxSelectionCount) { String message = "Please select only " + myMaxSelectionCount + " module"; if (myMaxSelectionCount > 1) { message += "s"; } message += "."; return new ValidationInfo(message, myModulesTable); } return null; }
@Nullable @Override protected ValidationInfo doValidate() { String path = myPathTextFieldWithButton.getText().trim(); JTextField textField = myPathTextFieldWithButton.getTextField(); if (path.isEmpty()) { return new ValidationInfo("Destination should not be empty", textField); } File f = new File(path); if (!f.isAbsolute()) { return new ValidationInfo("Destination path must be absolute.", textField); } if (f.getParentFile() == null || !f.getParentFile().isDirectory()) { return new ValidationInfo("Invalid path", textField); } return null; }
@Nullable @Override protected ValidationInfo doValidate() { ValidationInfo info = validateIntegerMultipleOf(myBitRateTextField, 1, "Bit Rate must be an integer."); if (info != null) { return info; } // MediaEncoder prefers sizes that are multiples of 16 (https://code.google.com/p/android/issues/detail?id=37769). info = validateIntegerMultipleOf(myWidthTextField, 16, "Width must be an integer."); if (info != null) { return info; } info = validateIntegerMultipleOf(myHeightTextField, 16, "Height must be an integer."); if (info != null) { return info; } return super.doValidate(); }
@Nullable private static ValidationInfo validateIntegerMultipleOf(JTextField textField, int multiple, String errorMessage) { String s = getText(textField); if (s.isEmpty()) { return null; } int x; try { x = Integer.parseInt(s); } catch (NumberFormatException e) { return new ValidationInfo(errorMessage, textField); } return (x % multiple > 0) ? new ValidationInfo("Must be a multiple of " + multiple, textField) : null; }
@Nullable @Override protected ValidationInfo doValidate() { if (myKeyField.getText().isEmpty()) { return new ValidationInfo("Key cannot be empty", myKeyField); } String key = myKeyField.getText().trim(); String error = myResourceNameValidator.getErrorText(key); if (error != null) { return new ValidationInfo(error, myKeyField); } if (myDefaultValueField.getText().isEmpty()) { return new ValidationInfo("Default Value cannot be empty", myDefaultValueField); } return null; }
@Nullable @Override protected ValidationInfo doValidate() { String newStyleName = myStyleNameTextField.getText(); if (Strings.isNullOrEmpty(newStyleName)) { return new ValidationInfo(myEmptyStyleValidationText, myStyleNameTextField); } if (!myResourceNameValidator.checkInput(newStyleName)) { // If checkInput is false, getErrorText will be not null. //noinspection ConstantConditions return new ValidationInfo(myResourceNameValidator.getErrorText(newStyleName), myStyleNameTextField); } return super.doValidate(); }
@Nullable @Override protected ValidationInfo doValidate() { if (myCreateBranch.isSelected()) { String branchName = myBranchName.getText().trim(); if (branchName.isEmpty()) { return new ValidationInfo("Branch name should not be empty", myBranchName); } else if (branchName.contains(" ")) { return new ValidationInfo("Branch name should not contain spaces"); } else { return null; } } if (myCreateChangelist.isSelected()) { if (myChangelistName.getText().trim().isEmpty()) { return new ValidationInfo("Changelist name should not be empty"); } } return null; }
@Nullable @Override protected ValidationInfo doValidate() { String packageName = packageNameField.getText(); if (packageName == null) { return new ValidationInfo("Internal error, package was null"); } if (packageName.length() == 0) { return new ValidationInfo( IdeBundle.message("error.name.should.be.specified"), packageNameField); } String error = Label.validatePackagePath(packageName); if (error != null) { return new ValidationInfo(error, packageNameField); } return newRuleUI.validate(); }
@Nullable @Override protected ValidationInfo doValidate() { String outputDir = getOutputDirectoryPath(); if (outputDir.isEmpty()) { return new ValidationInfo("Choose an output directory"); } if (!FileOperationProvider.getInstance().exists(new File(outputDir))) { return new ValidationInfo("Invalid output directory"); } Set<String> names = new HashSet<>(); for (int i = 0; i < configurations.size(); i++) { if (!tableModel.enabled[i]) { continue; } if (!names.add(tableModel.paths[i])) { return new ValidationInfo("Duplicate output file name '" + tableModel.paths[i] + "'"); } } return null; }
protected ValidationInfo validate() { updateModel(); // Check the model first final ModelValidationInfo validationInfo = model.validate(); if (validationInfo != ModelValidationInfo.NO_ERRORS) { return new ValidationInfo(validationInfo.getValidationMessage(), dialog.getComponent(validationInfo.getValidationSource())); } // The check the dialog final String error = dialog.getFirstMappingValidationError(); if (StringUtils.isNotEmpty(error)) { return new ValidationInfo(error); } return null; }
@Nullable @Override protected ValidationInfo doValidate() { if(this.module.getSelectedIndex() == -1) { return new ValidationInfo("No RoboVM module selected"); } if(this.destinationDir.getText() == null || this.destinationDir.getText().length() == 0) { return new ValidationInfo("Specify a destination directory"); } File destDir = new File(this.destinationDir.getText()); if(!destDir.exists()) { return new ValidationInfo("Destination directory does not exist"); } if(!destDir.isDirectory()) { return new ValidationInfo("Destination is not a directory"); } if(signingIdentity.getItemCount() == 0) { return new ValidationInfo("No signing identity found"); } if(provisioningProfile.getItemCount() == 0) { return new ValidationInfo("No provisioning profile found"); } return null; }
/** * If there is no module loaded (including no default module) then this indicates that the async * module loading is still in progress. We do not want to display an error to the user until the * thread completes to avoid flashing error messages */ public void testUnknownProjectSelected() { CloudAttachDialog dialog = initDialog(); mockLoggedInUser(); selectInProgressProject(); ValidationInfo error = dialog.doValidate(); assertNull(error); assertFalse(targetSelector.isEnabled()); assertNull(targetSelector.getSelectedItem()); // We want to make sure that the OK button is disabled, though. assertFalse(dialog.isOKActionEnabled()); dialog.close(0); }
@Nullable @Override protected ValidationInfo doValidate() { if (StringUtils.isEmpty(comboBoxIcon.getInputText().trim())) { return new ValidationInfo(ERROR_ICON_NOT_SELECTED, comboBoxIcon); } if (StringUtils.isEmpty(textFieldFileName.getText().trim())) { return new ValidationInfo(ERROR_FILE_NAME_EMPTY, textFieldFileName); } if (!checkBoxMdpi.isSelected() && !checkBoxHdpi.isSelected() && !checkBoxXhdpi.isSelected() && !checkBoxXxhdpi.isSelected() && !checkBoxXxxhdpi.isSelected()) { return new ValidationInfo(ERROR_SIZE_CHECK_EMPTY, checkBoxMdpi); } File resourcePath = new File(model.getResourcePath(project)); if (!resourcePath.exists() || !resourcePath.isDirectory()) { return new ValidationInfo(ERROR_RESOURCE_DIR_NOTHING_PREFIX + resourcePath, panelMain); } return null; }
@Nullable @Override protected ValidationInfo doValidate() { if (fileRadioBtn.isSelected()) { if (fileTxt.getText().isEmpty()) { return new ValidationInfo(message("appDlgInvFileTtl"), fileTxt); } else { File file = new File(fileTxt.getText()); if (!file.exists()) { return new ValidationInfo(message("appDlgInvFileMsg"), fileTxt); } } } else if (projRadioBtn.isSelected() && !asNameTxt.getText().isEmpty() && !(projCombo.getSelectedItem() == null)) { boolean isValidName; try { isValidName = waRole.isValidDeployName(asNameTxt.getText()); } catch (Exception e) { isValidName = false; } if (!isValidName) { return new ValidationInfo(message("appDlgInvNmeMsg"), asNameTxt); } } return null; }
@Nullable protected ValidationInfo doValidate() { String host = storageAccountTxt.getText(); String location = (String) locationComb.getSelectedItem(); boolean legalName = validateStorageAccountName(host); if (host == null || host.isEmpty()) { return new ValidationInfo(message("storageAccountIsNullError"), storageAccountTxt); } if (!legalName) { return new ValidationInfo(message("wrongStorageName"), storageAccountTxt); } if (location == null || location.isEmpty()) { return new ValidationInfo(message("hostedLocNotSelectedError"), locationComb); } // setMessage(message("storageCreateNew")); return null; }
@Override public ValidationInfo doValidate() { String projName = projectName.getText(); if (projName.isEmpty()) { myModel.getCurrentNavigationState().NEXT.setEnabled(false); return null; } /*else if (!projNameStatus.isOK()) { setErrorMessage(projNameStatus.getMessage()); setPageComplete(false); } */ else if (ModuleManager.getInstance(myModel.getMyProject()).findModuleByName(projName) != null) { return createValidationInfo(message("wizPageErrMsg1"), projectName); } else if (!(new File(projectLocation.getText()).exists())) { return createValidationInfo(message("wizPageErrPath"), projectLocation); } else { myModel.getCurrentNavigationState().NEXT.setEnabled(true); return null; } }
@Nullable @Override public ValidationInfo doValidate() { String userName = txtUserName.getText(); String newPath = txtPath.getText(); // String expDate = txtExpiryDate.getText(); if (newPath.startsWith(BASE_PATH)) { newPath = newPath.substring(newPath.indexOf("}") + 1, newPath.length()); newPath = String.format("%s%s", PluginUtil.getModulePath(myModule), newPath); } File cerFile = new File(newPath); boolean isRemoteEnabled = remoteChkBtn.isSelected(); if (isRemoteEnabled && userName.isEmpty()) { return new ValidationInfo(message("remAccNameNull"), txtUserName); } /*else if (isRemoteEnabled && txtExpiryDate.isEmpty()) { return new ValidationInfo(message("remAccExpDateNull"), txtExpiryDate); } */ else if (isRemoteEnabled && (!cerFile.exists() || (!newPath.endsWith(".cer")))) { return new ValidationInfo(message("remAccInvldPath"), txtPath); } else { return null; } }
@Override protected ValidationInfo doValidate() { Object subscription = subscriptionCombo.getSelectedItem(); if (subscription == null) { return new ValidationInfo("subscription can not be null or empty"); } Object service = hostedServiceCombo.getSelectedItem(); if (service == null) { return new ValidationInfo(message("hostedServiceIsNull")); } ElementWrapper<Deployment> deploymentItem = (ElementWrapper<Deployment>) deploymentCombo.getSelectedItem(); if (deploymentItem == null) { return new ValidationInfo(message("deploymentIsNull")); } return null; }
@Nullable protected ValidationInfo doValidate() { String host = hostedServiceTxt.getText(); String location = (String) locationComb.getSelectedItem(); boolean legalName = validateHostedServiceName(host); if (host == null || host.isEmpty()) { return new ValidationInfo(message("hostedIsNullError"), hostedServiceTxt); } if (!legalName) { return new ValidationInfo("<html>Hosted Service name may consist only of<br>numbers and lower case letters, and be 3-24 characters long.</html>", hostedServiceTxt); } if (location == null || location.isEmpty()) { return new ValidationInfo(message("hostedLocNotSelectedError"), locationComb); } // setMessage(message("hostedCreateNew")); return null; }
@Nullable @Override protected ValidationInfo doValidate() { if (StringUtils.isEmpty(resRoot.getText().trim())) { return new ValidationInfo("Please select the resources root.", resRoot); } if (StringUtils.isEmpty(resExportName.getText().trim())) { return new ValidationInfo("Please select a name for the drawable.", resExportName); } else if (!resExportName.getText().matches("[a-z0-9_.]*")) { return new ValidationInfo( "Please select a valid name for the drawable. There are just \"[a-z0-9_.]\" allowed.", resExportName); } return null; }
@Nullable @Override protected ValidationInfo doValidate() { if (StringUtils.isEmpty(resRoot.getText().trim())) { return new ValidationInfo("Please select the resources root.", resRoot); } if (StringUtils.isEmpty(resExportName.getText().trim())) { return new ValidationInfo("Please select a name for the drawable.", resExportName); } else if (!resExportName.getText().matches("[a-z0-9_.]*")) { return new ValidationInfo( "Please select a valid name for the drawable. There are just \"[a-z0-9_.]\" allowed.", resExportName); } return super.doValidate(); }
@Nullable @Override protected ValidationInfo doValidate() { final String name = nameTextField.getText(); final String replyURL = redirectURITextField.getText(); if (StringHelper.isNullOrWhiteSpace(name)) { return new ValidationInfo("The application name must not be empty.", nameTextField); } else if (name.length() > 64) { return new ValidationInfo("The application name cannot be more than 64 characters long.", nameTextField); } if (StringHelper.isNullOrWhiteSpace(replyURL)) { return new ValidationInfo("The redirect URI must not be empty.", redirectURITextField); } else { try { new URI(replyURL); } catch (URISyntaxException e) { return new ValidationInfo("The redirect URI must be a valid URI.", redirectURITextField); } } return null; }
@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; }
@Nullable @Override protected ValidationInfo doValidate() { String keyName = getKey(); if (StringUtils.isBlank(keyName)) { return new ValidationInfo("Key name is not set"); } if (mongoEditionPanel.containsKey(keyName)) { return new ValidationInfo(String.format("Key '%s' is already used", keyName)); } try { currentEditor.validate(); } catch (Exception ex) { return new ValidationInfo(ex.getMessage()); } return null; }
@Nullable @Override public ValidationInfo doValidate() { if (generatorComboBox.getSelectedItem() == null) { return new ValidationInfo("Please specify generator", generatorComboBox); } if (runComboBox.getSelectedItem() == null || ((String) runComboBox.getSelectedItem()).isEmpty()) { return new ValidationInfo("Please specify run type", runComboBox); } if (durationField.getText().isEmpty()) { return new ValidationInfo("Please specify duration", durationField); } if (threadsField.getText().isEmpty()) { return new ValidationInfo("Please specify number of threads", threadsField); } return null; }