Search in sources :

Example 1 with Configuration

use of com.android.tools.idea.gradle.structure.dependencies.android.Configuration in project android by JetBrains.

the class AndroidDependencyScopesPanel method validateInput.

@Override
@Nullable
public ValidationInfo validateInput() {
    List<Configuration> configurations = myConfigurationsPanel.getSelectedConfigurations();
    if (configurations.isEmpty()) {
        return new ValidationInfo("Please select at least one configuration", myConfigurationsPanel);
    }
    List<PsBuildType> buildTypes = myBuildTypesPanel.getSelectedBuildTypes();
    if (buildTypes.isEmpty()) {
        return new ValidationInfo("Please select at least one build type", myBuildTypesPanel);
    }
    if (mySelectedScopeNames.isEmpty()) {
        if (configurations.size() == 1 && configurations.contains(ANDROID_TEST)) {
            boolean hasDebugBuildType = false;
            for (PsBuildType buildType : buildTypes) {
                if (buildType.getName().equals(DEBUG_BUILD_TYPE)) {
                    hasDebugBuildType = true;
                    break;
                }
            }
            if (!hasDebugBuildType) {
                return new ValidationInfo("For 'Android Tests', the 'debug' build type must be selected", myBuildTypesPanel);
            }
        }
    }
    return null;
}
Also used : ValidationInfo(com.intellij.openapi.ui.ValidationInfo) PsBuildType(com.android.tools.idea.gradle.structure.model.android.PsBuildType) Configuration(com.android.tools.idea.gradle.structure.dependencies.android.Configuration) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Configuration (com.android.tools.idea.gradle.structure.dependencies.android.Configuration)1 PsBuildType (com.android.tools.idea.gradle.structure.model.android.PsBuildType)1 ValidationInfo (com.intellij.openapi.ui.ValidationInfo)1 Nullable (org.jetbrains.annotations.Nullable)1