use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.
the class AzureNewDockerHostStep method validateDockerHostName.
private ValidationInfo validateDockerHostName(boolean shakeOnError) {
// Docker virtual machine name
String hostName = dockerHostNameTextField.getText();
if (hostName == null || hostName.isEmpty() || !AzureDockerValidationUtils.validateDockerHostName(hostName)) {
ValidationInfo info = AzureDockerUIResources.validateComponent("Missing virtual machine name", rootConfigureContainerPanel, dockerHostNameTextField, dockerHostNameLabel);
setDialogButtonsState(false);
if (shakeOnError) {
model.DialogShaker(info);
}
return info;
}
newHost.name = hostName;
newHost.hostVM.name = hostName;
newHost.certVault.hostName = hostName;
newHost.hostVM.publicIpName = hostName + "-pip";
return null;
}
use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.
the class AzureSelectDockerWizardModel method doValidate.
public ValidationInfo doValidate() {
ValidationInfo validationInfo = selectDockerHostForm.doValidate();
if (validationInfo != null) {
finishedOK = false;
return validationInfo;
}
validationInfo = configureDockerContainerForm.doValidate();
if (validationInfo != null) {
finishedOK = false;
return validationInfo;
}
if (!dockerImageDescription.hasNewDockerHost && dockerImageDescription.host.state != DockerHost.DockerHostVMState.RUNNING && !DefaultLoader.getUIHelper().showConfirmation(String.format("The selected Docker host %s state is %s and publishing could fail.\n\n Do you want to continue?", dockerImageDescription.host.name, dockerImageDescription.host.state), "Docker Host Not in Running State", new String[] { "Yes", "No" }, null)) {
ValidationInfo info = new ValidationInfo("Invalid Docker host selection", selectDockerHostForm.getPreferredFocusedComponent());
finishedOK = false;
return info;
}
finishedOK = true;
return null;
}
use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.
the class AzureNewDockerHostStep method validateDockerSubscription.
private ValidationInfo validateDockerSubscription(boolean shakeOnError) {
// Subscription
AzureDockerSubscription currentSubscription = (AzureDockerSubscription) dockerSubscriptionComboBox.getSelectedItem();
if (currentSubscription == null || currentSubscription.id == null || currentSubscription.id.isEmpty()) {
ValidationInfo info = AzureDockerUIResources.validateComponent("Subscription not found", rootConfigureContainerPanel, dockerSubscriptionComboBox, null);
setDialogButtonsState(false);
if (shakeOnError) {
model.DialogShaker(info);
}
return info;
}
newHost.sid = currentSubscription.id;
return null;
}
use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.
the class AzureNewDockerHostStep method validateDockerLocation.
private ValidationInfo validateDockerLocation(boolean shakeOnError) {
// Location/region
String region = (String) dockerLocationComboBox.getSelectedItem();
if (preferredLocation == null || region == null || region.isEmpty()) {
ValidationInfo info = AzureDockerUIResources.validateComponent("Location not found", rootConfigureContainerPanel, dockerLocationComboBox, null);
setDialogButtonsState(false);
if (shakeOnError) {
model.DialogShaker(info);
}
return info;
}
newHost.hostVM.region = preferredLocation;
newHost.hostVM.dnsName = String.format("%s.%s.cloudapp.azure.com", newHost.hostVM.name, newHost.hostVM.region);
newHost.apiUrl = newHost.hostVM.dnsName;
return null;
}
use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.
the class NewCertificateDialog method doValidate.
@Nullable
protected ValidationInfo doValidate() {
if (txtPwd.getPassword().length == 0) {
return new ValidationInfo(message("newCertDlgPwNul"), txtPwd);
} else if (txtConfirmPwd.getPassword().length == 0) {
return new ValidationInfo(message("newCertDlgPwNul"), txtPwd);
}
Pattern pattern = Pattern.compile("^\\S+$");
Matcher match = pattern.matcher(String.valueOf(txtPwd.getPassword()));
if (!match.find()) {
return new ValidationInfo(message("newCertDlgPwNtCor"), txtPwd);
}
match = pattern.matcher(String.valueOf(txtConfirmPwd.getPassword()));
if (!match.find()) {
return new ValidationInfo(message("newCertDlgPwNtCor"), txtPwd);
}
if (!Arrays.equals(txtPwd.getPassword(), txtConfirmPwd.getPassword())) {
return new ValidationInfo(message("newCerDlgPwNtMsg"));
}
if (txtCNName.getText().isEmpty()) {
return new ValidationInfo(message("newCertDlgCNNull"), txtCNName);
}
if (txtCertFile.getText().isEmpty()) {
return new ValidationInfo(message("newCertDlgCerNul"), txtCertFile);
}
if (txtPFXFile.getText().isEmpty()) {
return new ValidationInfo(message("newCertDlgPFXNull"), txtPFXFile);
}
String certFilePath = txtCertFile.getText();
String pfxFilePath = txtPFXFile.getText();
if (certFilePath.lastIndexOf(File.separator) == -1 || pfxFilePath.lastIndexOf(File.separator) == -1) {
return new ValidationInfo(message("newCerDlgInvldPth"));
}
if ((!certFilePath.endsWith(".cer")) || (!pfxFilePath.endsWith(".pfx"))) {
return new ValidationInfo(message("newCerDlgInvdFlExt"));
}
String certFolder = certFilePath.substring(0, certFilePath.lastIndexOf(File.separator));
String pfxFolder = pfxFilePath.substring(0, pfxFilePath.lastIndexOf(File.separator));
File certFile = new File(certFolder);
File pfxFile = new File(pfxFolder);
if (!(certFile.exists() && pfxFile.exists())) {
return new ValidationInfo(message("newCerDlgInvldPth"));
}
return null;
}
Aggregations