use of com.intellij.ui.wizard.WizardStep in project azure-tools-for-java by Microsoft.
the class MachineSettingsStep method onNext.
@Override
public WizardStep onNext(VMWizardModel model) {
WizardStep wizardStep = super.onNext(model);
String name = vmNameTextField.getText();
if (name.length() > 15 || name.length() < 3) {
JOptionPane.showMessageDialog(null, "Invalid virtual machine name. The name must be between 3 and 15 character long.", "Error creating the virtual machine", JOptionPane.ERROR_MESSAGE);
return this;
}
if (!name.matches("^[A-Za-z][A-Za-z0-9-]+[A-Za-z0-9]$")) {
JOptionPane.showMessageDialog(null, "Invalid virtual machine name. The name must start with a letter, \n" + "contain only letters, numbers, and hyphens, " + "and end with a letter or number.", "Error creating the virtual machine", JOptionPane.ERROR_MESSAGE);
return this;
}
String password = passwordCheckBox.isSelected() ? new String(vmPasswordField.getPassword()) : "";
if (passwordCheckBox.isSelected()) {
String conf = new String(confirmPasswordField.getPassword());
if (!password.equals(conf)) {
JOptionPane.showMessageDialog(null, "Password confirmation should match password", "Error creating the service", JOptionPane.ERROR_MESSAGE);
return this;
}
if (!password.matches("(?=^.{8,255}$)((?=.*\\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*")) {
JOptionPane.showMessageDialog(null, "The password does not conform to complexity requirements.\n" + "It should be at least eight characters long and contain a mixture of upper case, lower case, digits and symbols.", "Error creating the virtual machine", JOptionPane.ERROR_MESSAGE);
return this;
}
}
String certificate = certificateCheckBox.isSelected() ? certificateField.getText() : "";
model.setName(name);
model.setSize((String) vmSizeComboBox.getSelectedItem());
model.setUserName(vmUserTextField.getText());
model.setPassword(password);
model.setCertificate(certificate);
return wizardStep;
}
use of com.intellij.ui.wizard.WizardStep in project intellij-community by JetBrains.
the class SelectPluginsStep method onPrevious.
@Override
public WizardStep onPrevious(final StartupWizardModel model) {
final WizardStep prev = super.onPrevious(model);
if (prev instanceof SelectPluginsStep) {
final SelectPluginsStep selectPluginsStep = (SelectPluginsStep) prev;
final String id = selectPluginsStep.getRequirePlugin();
if (id != null && model.getDisabledPluginIds().contains(id) && !model.isFirst(prev)) {
return model.getPreviousFor(prev);
}
}
return prev;
}
use of com.intellij.ui.wizard.WizardStep in project azure-tools-for-java by Microsoft.
the class MachineSettingsStep method onNext.
@Override
public WizardStep onNext(VMWizardModel model) {
String name = vmNameTextField.getText();
if (name.length() > 15 || name.length() < 3) {
DefaultLoader.getUIHelper().showError("Invalid virtual machine name. The name must be between 3 and 15 " + "character long.", "Error creating the virtual machine");
return this;
}
if (!name.matches("^[A-Za-z][A-Za-z0-9-]+[A-Za-z0-9]$")) {
DefaultLoader.getUIHelper().showError("Invalid virtual machine name. The name must start with a letter, \ncontain only letters, " + "numbers, and hyphens, and end with a letter or number.", "Error creating the virtual machine");
return this;
}
String password = passwordCheckBox.isSelected() ? new String(vmPasswordField.getPassword()) : "";
if (passwordCheckBox.isSelected()) {
String conf = new String(confirmPasswordField.getPassword());
if (!password.equals(conf)) {
DefaultLoader.getUIHelper().showError("Password confirmation should match password", "Error creating " + "the service");
return this;
}
if (!password.matches("(?=^.{8,255}$)((?=.*\\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\\d)(?=.*[^A-Za-z0-9])" + "(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|" + "(?=.*\\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*")) {
DefaultLoader.getUIHelper().showError("The password does not conform to complexity requirements.\nIt should be at least eight " + "characters long and contain a mixture of upper case, lower case, digits and " + "symbols.", "Error creating the virtual machine");
return this;
}
}
String certificate = certificateCheckBox.isSelected() ? certificateField.getText() : "";
model.setName(name);
model.setSize((String) vmSizeComboBox.getSelectedItem());
model.setUserName(vmUserTextField.getText());
model.setPassword(password);
model.setCertificate(certificate);
WizardStep wizardStep = super.onNext(model);
return wizardStep;
}
use of com.intellij.ui.wizard.WizardStep in project intellij-community by JetBrains.
the class SelectPluginsStep method onNext.
@Override
public WizardStep onNext(final StartupWizardModel model) {
final WizardStep next = super.onNext(model);
if (next instanceof SelectPluginsStep) {
final SelectPluginsStep selectPluginsStep = (SelectPluginsStep) next;
final String id = selectPluginsStep.getRequirePlugin();
if (id != null && model.getDisabledPluginIds().contains(id) && !model.isLast(next)) {
for (IdeaPluginDescriptor descriptor : selectPluginsStep.getPlugins()) {
model.getDisabledPluginIds().add(descriptor.getPluginId().getIdString());
}
return model.getNextFor(next);
}
}
return next;
}
Aggregations