Example usage for com.intellij.openapi.ui ValidationInfo ValidationInfo

List of usage examples for com.intellij.openapi.ui ValidationInfo ValidationInfo

Introduction

In this page you can find the example usage for com.intellij.openapi.ui ValidationInfo ValidationInfo.

Prototype

public ValidationInfo(@NotNull String message) 

Source Link

Document

Creates a validation error message not associated with a specific component.

Usage

From source file:au.com.borner.salesforce.plugin.panels.NewInstanceDialog.java

License:Apache License

@Nullable
@Override//  www .  j a va  2s .  co m
protected ValidationInfo doValidate() {
    try {
        instanceCredentialsPanel.validate();
    } catch (ConfigurationException e) {
        return new ValidationInfo(e.getMessage());
    }
    return null;
}

From source file:com.android.tools.idea.configurations.ThemeSelectionDialog.java

License:Apache License

@Override
@Nullable// w w  w.j av  a2  s  . co  m
protected ValidationInfo doValidate() {
    String theme = myPanel.getTheme();
    if (theme == null) {
        return new ValidationInfo("Select a theme");
    }
    return null;
}

From source file:com.android.tools.idea.gradle.variant.conflict.ConflictResolutionDialog.java

License:Apache License

@Override
@Nullable//from www.jav  a 2s.  c  om
protected ValidationInfo doValidate() {
    if (StringUtil.isEmpty(getSelectedVariant())) {
        return new ValidationInfo("Please choose the variant to set");
    }
    return null;
}

From source file:com.android.tools.idea.run.DeviceChooser.java

License:Apache License

@Nullable
public ValidationInfo doValidate() {
    if (!myDeviceTable.isEnabled()) {
        return null;
    }// ww w. j a va  2  s.  co m

    int[] rows = mySelectedRows != null ? mySelectedRows : myDeviceTable.getSelectedRows();
    boolean hasIncompatible = false;
    boolean hasCompatible = false;
    for (int row : rows) {
        if (!isRowCompatible(row)) {
            hasIncompatible = true;
        } else {
            hasCompatible = true;
        }
    }
    if (!hasIncompatible) {
        return null;
    }
    String message;
    if (hasCompatible) {
        message = "At least one of the selected devices is incompatible. Will only install on compatible devices.";
    } else {
        String devicesAre = rows.length > 1 ? "devices are" : "device is";
        message = "The selected " + devicesAre + " incompatible.";
    }
    return new ValidationInfo(message);
}

From source file:com.google.cloud.tools.intellij.debugger.ui.CloudAttachDialog.java

License:Apache License

@Override
protected ValidationInfo doValidate() {
    // These should not normally occur.
    if (!Services.getLoginService().isLoggedIn()) {
        return new ValidationInfo(GctBundle.getString("clouddebug.nologin"));
    }/*  w w  w. java 2 s  .  c om*/

    if (Strings.isNullOrEmpty(elysiumProjectSelector.getText())) {
        return new ValidationInfo(GctBundle.getString("clouddebug.noprojectid"), elysiumProjectSelector);
    }

    // validation should run only after the query for debug targets has results
    // assumption: either an ErrorHolder or one or more DebugTargets are added to the selector when
    //             the result is available
    if (!targetSelector.isEnabled()) {
        if (targetSelector.getItemCount() > 0) {
            if (targetSelector.getSelectedItem() instanceof ErrorHolder) {
                return new ValidationInfo(((ErrorHolder) targetSelector.getSelectedItem()).getErrorMessage(),
                        elysiumProjectSelector);
            } else {
                return new ValidationInfo(GctBundle.getString("clouddebug.nomodulesfound"),
                        elysiumProjectSelector);
            }
        } else if (wireup.isCdbQueried()) {
            // We went to CDB and detected no debuggees.
            return new ValidationInfo(GctBundle.getString("clouddebug.debug.targets.accessdenied"),
                    elysiumProjectSelector);
        }
    }

    // validation should run only after the query for debug targets has results
    // assumption: either an ErrorHolder or one or more DebugTargets are added to the selector when
    //             the result is available
    if (targetSelector.getSelectedItem() == null && targetSelector.getItemCount() > 0) {
        return new ValidationInfo(GctBundle.getString("clouddebug.nomodulesfound"), targetSelector);
    }

    return null;
}

From source file:com.google.gct.idea.appengine.deploy.AppEngineUpdateDialog.java

License:Apache License

@Override
protected ValidationInfo doValidate() {
    // These should not normally occur..
    if (!GoogleLogin.getInstance().isLoggedIn()) {
        return new ValidationInfo("You must be logged in to perform this action.");
    }/*from   ww w  .  j  a va2 s. c  o  m*/

    Module module = myModuleComboBox.getSelectedModule();
    if (module == null) {
        return new ValidationInfo("Select a module");
    }

    AppEngineGradleFacet facet = AppEngineGradleFacet.getAppEngineFacetByModule(module);
    if (facet == null) {
        return new ValidationInfo("Could not find App Engine gradle configuration on Module");
    }

    // We'll let AppCfg error if the project is wrong.  The user can see this in the console window.
    // Note that version can be blank to indicate current version.
    if (Strings.isNullOrEmpty(myElysiumProjectId.getText())) {
        return new ValidationInfo("Please enter a Project ID.");
    }

    return null;
}

From source file:com.google.gct.idea.debugger.ui.CloudAttachDialog.java

License:Apache License

@Override
protected ValidationInfo doValidate() {
    // These should not normally occur..
    if (!GoogleLogin.getInstance().isLoggedIn()) {
        return new ValidationInfo(GctBundle.getString("clouddebug.nologin"));
    }/*  ww w. ja  v a 2  s. c o  m*/

    if (Strings.isNullOrEmpty(myElysiumProjectId.getText())) {
        return new ValidationInfo(GctBundle.getString("clouddebug.noprojectid"));
    }

    if (myDebuggeeTarget.getSelectedItem() == null) {
        return new ValidationInfo(GctBundle.getString("clouddebug.nomodule"));
    }

    return null;
}

From source file:com.google.gct.intellij.endpoints.action.ui.GenerateBackendDialog.java

License:Apache License

@Override
protected ValidationInfo doValidate() {
    if (!myProjectNumField.getText().trim().matches("[0-9]*")) {
        return new ValidationInfo("Project Number must be numeric");
    }/* w w w .j  a  va  2s  .  c om*/
    return null;
}

From source file:com.google.idea.blaze.base.ide.NewBlazePackageDialog.java

License:Open Source License

@Nullable
@Override// w w w .  jav  a  2  s  . c o m
protected ValidationInfo doValidate() {
    String packageName = packageNameField.getText();
    if (packageName == null) {
        return new ValidationInfo("Internal error, package was null");
    }
    if (packageName.length() == 0) {
        return new ValidationInfo(IdeBundle.message("error.name.should.be.specified"), packageNameField);
    }
    List<BlazeValidationError> errors = Lists.newArrayList();
    if (!Label.validatePackagePath(packageName, errors)) {
        BlazeValidationError validationResult = errors.get(0);
        return new ValidationInfo(validationResult.getError(), packageNameField);
    }

    return newRuleUI.validate();
}

From source file:com.google.idea.blaze.base.run.exporter.ExportRunConfigurationDialog.java

License:Open Source License

@Nullable
@Override/*from   ww w. j  av  a2 s. c o m*/
protected ValidationInfo doValidate() {
    String outputDir = getOutputDirectoryPath();
    if (outputDir.isEmpty()) {
        return new ValidationInfo("Choose an output directory");
    }
    if (!FileAttributeProvider.getInstance().exists(new File(outputDir))) {
        return new ValidationInfo("Invalid output directory");
    }
    Set<String> names = new HashSet<>();
    for (int i = 0; i < blazeConfigurations.size(); i++) {
        if (!tableModel.enabled[i]) {
            continue;
        }
        if (!names.add(tableModel.paths[i])) {
            return new ValidationInfo("Duplicate output file name '" + tableModel.paths[i] + "'");
        }
    }
    return null;
}