Search in sources :

Example 6 with ValidationInfo

use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.

the class AzureSelectDockerHostStep method onNext.

@Override
public WizardStep onNext(final AzureSelectDockerWizardModel model) {
    if (dockerHostsTableSelection != null && doValidate() == null) {
        return super.onNext(model);
    } else {
        setDialogButtonsState(false);
        ValidationInfo info = new ValidationInfo("Please check a Docker host or create a new", dockerHostsTable);
        model.getSelectDockerWizardDialog().DialogShaker(info);
        return this;
    }
}
Also used : ValidationInfo(com.intellij.openapi.ui.ValidationInfo)

Example 7 with ValidationInfo

use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.

the class AzureNewDockerWizardModel method doValidate.

public ValidationInfo doValidate() {
    ValidationInfo validationInfo = newDockerHostStep.doValidate();
    if (validationInfo != null) {
        finishedOK = false;
        return validationInfo;
    }
    validationInfo = newDockerLoginStep.doValidate();
    if (validationInfo != null) {
        finishedOK = false;
        return validationInfo;
    }
    finishedOK = true;
    return null;
}
Also used : ValidationInfo(com.intellij.openapi.ui.ValidationInfo)

Example 8 with ValidationInfo

use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.

the class AzureNewDockerHostStep method validateDockerVMSize.

private ValidationInfo validateDockerVMSize(boolean shakeOnError) {
    // Docker virtual machine size
    String vmSize = (String) dockerHostVMSizeComboBox.getSelectedItem();
    if (vmSize == null || vmSize.isEmpty()) {
        ValidationInfo info = AzureDockerUIResources.validateComponent("Virtual machine size not found", vmKindPanel, dockerHostVMSizeComboBox, null);
        hostDetailsTabbedPane.setSelectedComponent(vmKindPanel);
        setDialogButtonsState(false);
        if (shakeOnError) {
            model.DialogShaker(info);
        }
        return info;
    }
    newHost.hostVM.vmSize = vmSize;
    return null;
}
Also used : ValidationInfo(com.intellij.openapi.ui.ValidationInfo)

Example 9 with ValidationInfo

use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.

the class AzureNewDockerHostStep method validateDockerVnet.

private ValidationInfo validateDockerVnet(boolean shakeOnError) {
    // Docker virtual network name
    if (dockerHostNewVNetRadioButton.isSelected()) {
        // New virtual network
        String vnetName = dockerHostNewVNetNameTextField.getText();
        if (vnetName == null || vnetName.isEmpty() || !AzureDockerValidationUtils.validateDockerVnetName(vnetName)) {
            ValidationInfo info = AzureDockerUIResources.validateComponent("Missing virtual network name", networkPanel, dockerHostNewVNetNameTextField, dockerHostNewVNetNameLabel);
            hostDetailsTabbedPane.setSelectedComponent(networkPanel);
            setDialogButtonsState(false);
            if (shakeOnError) {
                model.DialogShaker(info);
            }
            return info;
        }
        String vnetAddrSpace = dockerHostNewVNetAddrSpaceTextField.getText();
        if (vnetAddrSpace == null || vnetAddrSpace.isEmpty() || !AzureDockerValidationUtils.validateDockerVnetAddrSpace(vnetAddrSpace)) {
            ValidationInfo info = AzureDockerUIResources.validateComponent("Missing virtual network address space", networkPanel, dockerHostNewVNetAddrSpaceTextField, dockerHostNewVNetAddrSpaceLabel);
            hostDetailsTabbedPane.setSelectedComponent(networkPanel);
            setDialogButtonsState(false);
            if (shakeOnError) {
                model.DialogShaker(info);
            }
            return info;
        }
        newHost.hostVM.vnetName = vnetName;
        newHost.hostVM.vnetAddressSpace = vnetAddrSpace;
        newHost.hostVM.subnetName = "subnet1";
    } else {
        // Existing virtual network and subnet
        AzureDockerVnet vnet = (AzureDockerVnet) dockerHostSelectVnetComboBox.getSelectedItem();
        if (vnet == null || vnet.name == null || vnet.name.isEmpty()) {
            ValidationInfo info = AzureDockerUIResources.validateComponent("Missing virtual network selection", networkPanel, dockerHostSelectVnetComboBox, null);
            hostDetailsTabbedPane.setSelectedComponent(networkPanel);
            setDialogButtonsState(false);
            if (shakeOnError) {
                model.DialogShaker(info);
            }
            return info;
        }
        String subnet = (String) dockerHostSelectSubnetComboBox.getSelectedItem();
        if (subnet == null || subnet.isEmpty()) {
            hostDetailsTabbedPane.setSelectedComponent(networkPanel);
            ValidationInfo info = AzureDockerUIResources.validateComponent("Missing subnet selection", networkPanel, dockerHostSelectSubnetComboBox, null);
            setDialogButtonsState(false);
            if (shakeOnError) {
                model.DialogShaker(info);
            }
            return info;
        }
        // Add "@resourceGroupName" to mark this as an existing virtual network
        newHost.hostVM.vnetName = vnet.name + "@" + vnet.resourceGroup;
        newHost.hostVM.vnetAddressSpace = vnet.addrSpace;
        newHost.hostVM.subnetName = subnet;
    }
    return null;
}
Also used : ValidationInfo(com.intellij.openapi.ui.ValidationInfo)

Example 10 with ValidationInfo

use of com.intellij.openapi.ui.ValidationInfo in project azure-tools-for-java by Microsoft.

the class AzureNewDockerHostStep method validateDockerStorage.

private ValidationInfo validateDockerStorage(boolean shakeOnError) {
    // Docker storage account
    String vmSize = (String) dockerHostVMSizeComboBox.getSelectedItem();
    String storageName;
    if (dockerHostNewStorageRadioButton.isSelected()) {
        // New storage account
        storageName = dockerNewStorageTextField.getText();
        if (storageName == null || storageName.isEmpty() || vmSize == null || vmSize.isEmpty() || !AzureDockerValidationUtils.validateDockerHostStorageName(storageName, (AzureDockerSubscription) dockerSubscriptionComboBox.getSelectedItem())) {
            ValidationInfo info = AzureDockerUIResources.validateComponent("Missing storage account name", storagePanel, dockerNewStorageTextField, dockerNewStorageLabel);
            hostDetailsTabbedPane.setSelectedComponent(storagePanel);
            setDialogButtonsState(false);
            if (shakeOnError) {
                model.DialogShaker(info);
            }
            return info;
        }
        newHost.hostVM.storageAccountName = storageName;
        newHost.hostVM.storageAccountType = AzureDockerUtils.getStorageTypeForVMSize(vmSize);
    } else {
        // Existing resource group
        storageName = (String) dockerSelectStorageComboBox.getSelectedItem();
        if (storageName == null || storageName.isEmpty() || vmSize == null || vmSize.isEmpty()) {
            ValidationInfo info = AzureDockerUIResources.validateComponent("Missing storage account selection", storagePanel, dockerSelectStorageComboBox, null);
            hostDetailsTabbedPane.setSelectedComponent(storagePanel);
            setDialogButtonsState(false);
            if (shakeOnError) {
                model.DialogShaker(info);
            }
            return info;
        }
        // Add "@" to mark this as an existing storage account
        newHost.hostVM.storageAccountName = storageName + "@";
        newHost.hostVM.storageAccountType = AzureDockerUtils.getStorageTypeForVMSize(vmSize);
    }
    setDialogButtonsState(true);
    return null;
}
Also used : ValidationInfo(com.intellij.openapi.ui.ValidationInfo)

Aggregations

ValidationInfo (com.intellij.openapi.ui.ValidationInfo)53 Nullable (org.jetbrains.annotations.Nullable)24 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 File (java.io.File)7 Module (com.intellij.openapi.module.Module)3 Pattern (java.util.regex.Pattern)3 DocumentEvent (javax.swing.event.DocumentEvent)3 DefaultTableModel (javax.swing.table.DefaultTableModel)3 ActionButton (com.intellij.openapi.actionSystem.impl.ActionButton)2 Project (com.intellij.openapi.project.Project)2 PatternSyntaxException (java.util.regex.PatternSyntaxException)2 ResourceRepository (com.android.ide.common.resources.ResourceRepository)1 IAndroidTarget (com.android.sdklib.IAndroidTarget)1 Configuration (com.android.tools.idea.gradle.structure.dependencies.android.Configuration)1 PsArtifactDependencySpec (com.android.tools.idea.gradle.structure.model.PsArtifactDependencySpec)1 PsModule (com.android.tools.idea.gradle.structure.model.PsModule)1 PsAndroidModule (com.android.tools.idea.gradle.structure.model.android.PsAndroidModule)1 PsBuildType (com.android.tools.idea.gradle.structure.model.android.PsBuildType)1 PsLibraryAndroidDependency (com.android.tools.idea.gradle.structure.model.android.PsLibraryAndroidDependency)1 FilterData (com.android.tools.idea.logcat.PersistentAndroidLogFilters.FilterData)1