com.intellij.openapi.ui.ValidationInfo Java Examples
The following examples show how to use
com.intellij.openapi.ui.ValidationInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaterialDesignIconGenerateDialog.java From android-material-design-icon-generator-plugin with Apache License 2.0 | 6 votes |
@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; }
Example #2
Source File: SelectPackageTemplatePresenterImpl.java From PackageTemplates with Apache License 2.0 | 6 votes |
@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; }
Example #3
Source File: ConfigurePresenterImpl.java From PackageTemplates with Apache License 2.0 | 6 votes |
@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; }
Example #4
Source File: TextInjectionDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
@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; }
Example #5
Source File: CustomPathDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
@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; }
Example #6
Source File: SearchActionWrapper.java From PackageTemplates with Apache License 2.0 | 6 votes |
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; }
Example #7
Source File: CreateIpaDialog.java From robovm-idea with GNU General Public License v2.0 | 6 votes |
@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; }
Example #8
Source File: Neo4jBoltDataSourceDialog.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
@Nullable @Override protected ValidationInfo doValidate() { if (StringUtils.isBlank(dataSourceNameField.getText())) { return validation("Data source name must not be empty", dataSourceNameField); } if (StringUtils.isBlank(hostField.getText())) { return validation("Host must not be empty", hostField); } if (!StringUtils.isNumeric(portField.getText())) { return validation("Port must be numeric", portField); } extractData(); if (dataSourcesComponent.getDataSourceContainer().isDataSourceExists(data.dataSourceName)) { if (!(dataSourceToEdit != null && dataSourceToEdit.getName().equals(data.dataSourceName))) { return validation(String.format("Data source [%s] already exists", data.dataSourceName), dataSourceNameField); } } return null; }
Example #9
Source File: AddKeyDialog.java From nosql4idea with Apache License 2.0 | 6 votes |
@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; }
Example #10
Source File: WorkspaceController.java From azure-devops-intellij with MIT License | 6 votes |
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; }
Example #11
Source File: CreateOffice365ApplicationForm.java From Microsoft-Cloud-Services-for-Android with MIT License | 6 votes |
@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; }
Example #12
Source File: MaterialDesignIconGenerateDialog.java From android-material-design-icon-generator-plugin with Apache License 2.0 | 6 votes |
@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; }
Example #13
Source File: ExportRunConfigurationDialog.java From intellij with Apache License 2.0 | 6 votes |
@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; }
Example #14
Source File: ModelDialog.java From intellij-extra-icons-plugin with MIT License | 6 votes |
@Nullable @Override protected ValidationInfo doValidate() { if (modelIDField.isVisible() && modelIDField.getText().isEmpty()) { return new ValidationInfo("ID cannot be empty!", modelIDField); } if (descriptionField.getText().isEmpty()) { return new ValidationInfo("Description cannot be empty!", descriptionField); } if (customIconImage == null && modelToEdit == null) { return new ValidationInfo("Please add an icon!", chooseIconButton); } if (conditionsCheckboxList.isEmpty()) { return new ValidationInfo("Please add a condition to your model!", toolbarPanel); } return super.doValidate(); }
Example #15
Source File: ReplaceTypeCodeWithStateStrategyDialog.java From IntelliJDeodorant with MIT License | 6 votes |
private void handleInputChanged() { String classNamePattern = "[a-zA-Z_][a-zA-Z0-9_]*"; Set<String> encounteredNames = new HashSet<>(); List<ValidationInfo> validationInfoList = new ArrayList<>(); for (JTextField textField : textMap.keySet()) { String text = textField.getText(); if (!Pattern.matches(classNamePattern, textField.getText())) { validationInfoList.add(new ValidationInfo(IntelliJDeodorantBundle.message("replace.type.code.with.state.strategy.dialog.error.invalid"), textField)); } else if (parentPackage != null && parentPackage.containsClassNamed(text)) { validationInfoList.add(new ValidationInfo(IntelliJDeodorantBundle.message("replace.type.code.with.state.strategy.dialog.error.exists.package"), textField)); } else if (javaLangClassNames.contains(text)) { validationInfoList.add(new ValidationInfo(IntelliJDeodorantBundle.message("replace.type.code.with.state.strategy.dialog.error.exists.javalang"), textField)); } else if (encounteredNames.contains(text)) { validationInfoList.add(new ValidationInfo(IntelliJDeodorantBundle.message("replace.type.code.with.state.strategy.dialog.error.chosen"), textField)); } else { refactoring.setTypeNameForNamedConstant(textMap.get(textField), textField.getText()); } encounteredNames.add(text); } setErrorInfoAll(validationInfoList); mayApplyRefactoring(validationInfoList.isEmpty()); }
Example #16
Source File: NotificationHubConfigForm.java From Microsoft-Cloud-Services-for-Android with MIT License | 5 votes |
@Nullable @Override protected ValidationInfo doValidate() { String senderId = this.textSenderID.getText().trim(); String connectionString = this.textConnectionString.getText().trim(); String hubName = this.textHubName.getText().trim(); if (StringHelper.isNullOrWhiteSpace(senderId)) { return new ValidationInfo("The Sender ID must not be empty", textSenderID); } else if (!senderId.matches("^[0-9]+$")) { return new ValidationInfo("Invalid Sender ID. The Sender Id must contain only numbers.", textSenderID); } if (StringHelper.isNullOrWhiteSpace(connectionString)) { return new ValidationInfo("The Connection String must not be empty.", textConnectionString); } if (StringHelper.isNullOrWhiteSpace(hubName)) { return new ValidationInfo("The Notification Hub Name must not be empty", textHubName); } else { if (hubName.length() < 6 || hubName.length() > 50) { return new ValidationInfo("The Notification Hub Name must be between 6 and 50 characters long", textHubName); } if (!hubName.matches("^[A-Za-z][A-Za-z0-9-]+[A-Za-z0-9]$")) { return new ValidationInfo("Invalid Notification Hub name. The Notification Hub name must start with a letter, contain only letters, numbers, and hyphens, and end with a letter or number", textHubName); } } return super.doValidate(); }
Example #17
Source File: CreatePullRequestController.java From azure-devops-intellij with MIT License | 5 votes |
private void setupDialog() { this.createDialog.addValidationListener(new ValidationListener() { @Override public ValidationInfo doValidate() { return validate(); } }); }
Example #18
Source File: OneNoteConfigForm.java From Microsoft-Cloud-Services-for-Android with MIT License | 5 votes |
@Nullable @Override protected ValidationInfo doValidate() { return (clientIdTextField.getText().length() == 0) ? new ValidationInfo("Client ID should no be empty", clientIdTextField) : super.doValidate(); }
Example #19
Source File: MobileServiceConfigForm.java From Microsoft-Cloud-Services-for-Android with MIT License | 5 votes |
@Nullable @Override protected ValidationInfo doValidate() { return (mobileServices.getSelectedRows().length == 0) ? new ValidationInfo("Select a Mobile Service", mobileServices) : super.doValidate(); }
Example #20
Source File: SimpleCheckoutController.java From azure-devops-intellij with MIT License | 5 votes |
protected ValidationInfo validate() { updateModel(); ModelValidationInfo validationInfo = model.validate(); if (validationInfo != ModelValidationInfo.NO_ERRORS) { return new ValidationInfo(validationInfo.getValidationMessage(), dialog.getComponent(validationInfo.getValidationSource())); } return null; }
Example #21
Source File: SimpleCheckoutController.java From azure-devops-intellij with MIT License | 5 votes |
private void setupDialog() { dialog.setRepoUrl(model.getRepoUrl()); dialog.addValidationListener(new ValidationListener() { @Override public ValidationInfo doValidate() { return validate(); } }); }
Example #22
Source File: VueGeneratorPeer.java From vue-for-idea with BSD 3-Clause "New" or "Revised" License | 5 votes |
public boolean validateInIntelliJ() { final ValidationInfo info = validate(); if (info == null) { myErrorLabel.setVisible(false); return true; } else { myErrorLabel.setVisible(true); myErrorLabel.setText(XmlStringUtil.wrapInHtml("<font color='#" + ColorUtil.toHex(JBColor.RED) + "'><left>" + info.message + "</left></font>")); } return false; }
Example #23
Source File: CreateBranchController.java From azure-devops-intellij with MIT License | 5 votes |
protected ValidationInfo validate() { updateModel(); ModelValidationInfo validationInfo = model.validate(); if (validationInfo != ModelValidationInfo.NO_ERRORS) { return new ValidationInfo(validationInfo.getValidationMessage(), dialog.getComponent(validationInfo.getValidationSource())); } return null; }
Example #24
Source File: CreateBranchController.java From azure-devops-intellij with MIT License | 5 votes |
private void setupDialog() { dialog.addValidationListener(new ValidationListener() { @Override public ValidationInfo doValidate() { return validate(); } }); }
Example #25
Source File: CreatePullRequestController.java From azure-devops-intellij with MIT License | 5 votes |
private ValidationInfo validate() { updateModel(); ModelValidationInfo validationInfo = this.createModel.validate(); if (validationInfo != ModelValidationInfo.NO_ERRORS) { return new ValidationInfo(validationInfo.getValidationMessage(), this.createDialog.getComponent(validationInfo.getValidationSource())); } return null; }
Example #26
Source File: CreateBranchControllerTest.java From azure-devops-intellij with MIT License | 5 votes |
@Test public void testValidate_Errors() { ModelValidationInfo mockValidationInfo = mock(ModelValidationInfo.class); when(mockValidationInfo.getValidationMessage()).thenReturn(TfPluginBundle.KEY_CREATE_BRANCH_DIALOG_ERRORS_BRANCH_NAME_EMPTY); when(mockValidationInfo.getValidationSource()).thenReturn(CreateBranchModel.PROP_BRANCH_NAME); when(mockModel.validate()).thenReturn(mockValidationInfo); ValidationInfo validationInfo = underTest.validate(); Assert.assertEquals(TfPluginBundle.KEY_CREATE_BRANCH_DIALOG_ERRORS_BRANCH_NAME_EMPTY, validationInfo.message); }
Example #27
Source File: ImportController.java From azure-devops-intellij with MIT License | 5 votes |
private void setupDialog() { dialog.addTabPage(TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_DIALOG_VSO_TAB), vsoPageController.getPageAsPanel()); dialog.addTabPage(TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_DIALOG_TFS_TAB), tfsPageController.getPageAsPanel()); dialog.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (BaseDialog.CMD_OK.equals(e.getActionCommand())) { importIntoRepo(); } else if (BaseDialog.CMD_CANCEL.equals(e.getActionCommand())) { //TODO dispose of the model correctly model.dispose(); } else if (BaseDialog.CMD_TAB_CHANGED.equals(e.getActionCommand())) { model.clearErrors(); model.setVsoSelected(dialog.getSelectedTabIndex() == TAB_VSO); } } }); dialog.addValidationListener(new ValidationListener() { @Override public ValidationInfo doValidate() { return validate(); } }); if (ServerContextManager.getInstance().lastUsedContextIsTFS()) { dialog.setSelectedTabIndex(TAB_TFS); } dialog.setOkEnabled(model.isImportEnabled()); }
Example #28
Source File: WorkspaceController.java From azure-devops-intellij with MIT License | 5 votes |
private void setupDialog() { dialog.addValidationListener(new ValidationListener() { @Override public ValidationInfo doValidate() { return validate(); } }); }
Example #29
Source File: WorkspaceDialog.java From azure-devops-intellij with MIT License | 5 votes |
protected JComponent createCenterPanel() { if (workspaceForm == null) { // When we create the form we give it a validationListener so that the table can trigger our validate method workspaceForm = new WorkspaceForm(getProject(), (ServerContext) getProperty(PROP_SERVER_CONTEXT), new ValidationListener() { @Override public ValidationInfo doValidate() { validate(); return null; } }); } return workspaceForm.getContentPane(); }
Example #30
Source File: AddSourceToProjectDialog.java From intellij with Apache License 2.0 | 5 votes |
@Nullable @Override protected ValidationInfo doValidate() { List<TargetInfo> targets = getSelectedTargets(); if (targets.isEmpty()) { return new ValidationInfo("Choose a target building this source."); } return null; }