本文整理匯總了Java中com.intellij.openapi.ui.ValidationInfo類的典型用法代碼示例。如果您正苦於以下問題:Java ValidationInfo類的具體用法?Java ValidationInfo怎麽用?Java ValidationInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ValidationInfo類屬於com.intellij.openapi.ui包,在下文中一共展示了ValidationInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例2: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例3: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
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;
}
示例4: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例5: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例6: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例7: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例8: validate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例9: doOKAction
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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();
}
}
}
}
示例10: modifySettingsStep
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
};
}
示例11: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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);
}
示例12: validateMinimumGradleVersion
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例13: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例14: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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;
}
示例15: doValidate
import com.intellij.openapi.ui.ValidationInfo; //導入依賴的package包/類
@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();
}