use of com.intellij.openapi.ui.ValidationInfo in project android by JetBrains.
the class StateListPicker method doValidate.
/**
* Returns a {@link ValidationInfo} in the case one of the state list state has a value that does not resolve to a valid resource,
* or a value that is a private framework value. or if one of the state list component requires an API level higher than minApi.
*/
@Nullable
public /*if there is no error*/
ValidationInfo doValidate(int minApi) {
IAndroidTarget target = myConfiguration.getRealTarget();
assert target != null;
final AndroidTargetData androidTargetData = AndroidTargetData.getTargetData(target, myModule);
assert androidTargetData != null;
ResourceRepository frameworkResources = myConfiguration.getFrameworkResources();
assert frameworkResources != null;
for (StateComponent component : myStateComponents) {
ValidationInfo error = component.doValidate(minApi, androidTargetData);
if (error != null) {
return error;
}
}
return null;
}
use of com.intellij.openapi.ui.ValidationInfo in project intellij-plugins by JetBrains.
the class CreateAirDescriptorTemplateDialog method doValidate.
protected ValidationInfo doValidate() {
final String fileName = myDescriptorFileNameTextField.getText().trim();
if (fileName.isEmpty()) {
return new ValidationInfo("Descriptor file name not set", myDescriptorFileNameTextField);
}
if (!fileName.toLowerCase().endsWith(".xml")) {
return new ValidationInfo("Descriptor file name must have xml extension", myDescriptorFileNameTextField);
}
final String folderPath = myDescriptorFolderTextWithBrowse.getText().trim();
if (folderPath.isEmpty()) {
return new ValidationInfo("Folder is not set", myDescriptorFolderTextWithBrowse);
}
final VirtualFile dir = LocalFileSystem.getInstance().findFileByPath(folderPath);
if (dir != null && !dir.isDirectory()) {
return new ValidationInfo("Folder for AIR descriptor must be specified", myDescriptorFolderTextWithBrowse);
}
final String airVersion = ((String) myAirVersionCombo.getSelectedItem()).trim();
if (airVersion.isEmpty()) {
return new ValidationInfo("AIR version is not set", myAirVersionCombo);
}
if (!VERSION_PATTERN.matcher(airVersion).matches()) {
return new ValidationInfo("Incorrect AIR version", myAirVersionCombo);
}
final String appId = myAppIdTextField.getText().trim();
if (appId.isEmpty()) {
return new ValidationInfo("Application ID is required", myAppIdTextField);
}
if (!appId.equals(FlexCommonUtils.fixApplicationId(appId))) {
return new ValidationInfo("Application ID must contain only following symbols: 0-9, a-z, A-Z, '.', '-'", myAppIdTextField);
}
if (myAppNameTextField.getText().trim().isEmpty()) {
return new ValidationInfo("Application name is required", myAppNameTextField);
}
final String appVersion = myAppVersionTextField.getText().trim();
if (appVersion.isEmpty()) {
return new ValidationInfo("Application version is not set", myAppVersionTextField);
}
if (StringUtil.compareVersionNumbers(airVersion, "2.5") >= 0) {
if (!VERSION_PATTERN.matcher(appVersion).matches()) {
return new ValidationInfo("Application version must have following format: [0-999].[0-999].[0-999]", myAppVersionTextField);
}
}
return null;
}
use of com.intellij.openapi.ui.ValidationInfo in project intellij-plugins by JetBrains.
the class KeystorePasswordDialog method doValidate.
protected ValidationInfo doValidate() {
for (Trinity<AirSigningOptions, JPasswordField, JPasswordField> entry : myKeystoresAndPasswordFields) {
final AirSigningOptions signingOptions = entry.first;
final JPasswordField keystorePasswordField = entry.second;
final String keystorePassword = new String(keystorePasswordField.getPassword());
final JPasswordField keyPasswordField = entry.third;
final String keyPassword = keyPasswordField == null ? "" : new String(keyPasswordField.getPassword());
try {
PasswordStore.checkPassword(signingOptions, keystorePassword, keyPassword);
} catch (PasswordStore.SigningOptionsException e) {
final JPasswordField errorField = e.wrongKeyPassword ? keyPasswordField : e.wrongKeystorePassword ? keystorePasswordField : null;
final String message = errorField == null ? PathUtil.getFileName(signingOptions.getKeystorePath()) + ": " + e.getMessage() : e.getMessage();
return new ValidationInfo(message, errorField);
}
}
return null;
}
Aggregations