com.intellij.execution.configurations.RuntimeConfigurationWarning Java Examples

The following examples show how to use com.intellij.execution.configurations.RuntimeConfigurationWarning. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmbeddedLinuxJVMRunnerValidator.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Validates the PI Settings are Entered Correctly
 *
 * @param rp
 * @throws RuntimeConfigurationException
 */
public static void checkEmbeddedSettings(EmbeddedLinuxJVMRunConfigurationRunnerParameters rp) throws RuntimeConfigurationWarning {
    if (StringUtil.isEmptyOrSpaces(rp.getHostname())) {
        throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.hostname"));
    }
    if (StringUtil.isEmptyOrSpaces(rp.getPort())) {
        throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.port"));
    }
    if (StringUtil.isEmptyOrSpaces(rp.getUsername())) {
        throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.username"));
    }
    if (StringUtil.isEmptyOrSpaces(rp.getKeyPath()) && rp.isUsingKey()) {
        throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.key"));
    }
    if(StringUtil.isEmptyOrSpaces(String.valueOf(rp.getSshPort()))) {
        throw new RuntimeConfigurationWarning(EmbeddedLinuxJVMBundle.getString("pi.invalid.sshport"));
    }
}
 
Example #2
Source File: ProgramParametersConfigurator.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void checkWorkingDirectoryExist(CommonProgramRunConfigurationParameters configuration, Project project, Module module) throws RuntimeConfigurationWarning {
  final String workingDir = getWorkingDir(configuration, project, module);
  if (workingDir == null) {
    throw new RuntimeConfigurationWarning("Working directory is null for " +
                                          "project '" +
                                          project.getName() +
                                          "' (" +
                                          project.getBasePath() +
                                          ")" +
                                          ", module " +
                                          (module == null ? "null" : "'" + module.getName() + "' (" + module.getModuleDirPath() + ")"));
  }
  if (!new File(workingDir).exists()) {
    throw new RuntimeConfigurationWarning("Working directory '" + workingDir + "' doesn't exist");
  }
}
 
Example #3
Source File: BlazeAndroidRunConfigurationValidationUtil.java    From intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the top error, as determined by {@link ValidationError#compareTo(Object)}. If it is
 * fatal, it is thrown as a {@link RuntimeConfigurationError}; otherwise it is thrown as a {@link
 * RuntimeConfigurationWarning}. If no errors exist, nothing is thrown.
 */
public static void throwTopConfigurationError(List<ValidationError> errors)
    throws RuntimeConfigurationException {
  if (errors.isEmpty()) {
    return;
  }
  // TODO: Do something with the extra error information? Error count?
  ValidationError topError = Ordering.natural().max(errors);
  if (topError.isFatal()) {
    throw new RuntimeConfigurationError(topError.getMessage(), topError.getQuickfix());
  }
  throw new RuntimeConfigurationWarning(topError.getMessage(), topError.getQuickfix());
}
 
Example #4
Source File: EmbeddedLinuxJVMRunnerValidator.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Validates if the Java Settings are Entered Correctly
 *
 * @param configuration
 * @throws RuntimeConfigurationException
 */
public static void checkJavaSettings(EmbeddedLinuxJVMRunConfiguration configuration) throws RuntimeConfigurationException {
    JavaRunConfigurationModule javaRunConfigurationModule = new JavaRunConfigurationModule(configuration.getProject(), false);
    PsiClass psiClass = javaRunConfigurationModule.findClass(configuration.getRunnerParameters().getMainclass());
    if (psiClass == null) {
        throw new RuntimeConfigurationWarning(ExecutionBundle.message("main.method.not.found.in.class.error.message", configuration.getRunnerParameters().getMainclass()));
    }
}
 
Example #5
Source File: EmbeddedLinuxJVMRunnerValidatorTest.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 4 votes vote down vote up
@Test(expected = RuntimeConfigurationWarning.class)
public void nullRunnerSettings() throws RuntimeConfigurationWarning {
    EmbeddedLinuxJVMRunnerValidator.checkEmbeddedSettings(piRunnerParameters);
}
 
Example #6
Source File: AlternativeJreValidator.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void validate(XQueryRunConfiguration runConfiguration) throws RuntimeConfigurationWarning {
    checkAlternativeJRE(runConfiguration);
}
 
Example #7
Source File: AlternativeJreValidator.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public static void checkAlternativeJRE(@NotNull XQueryRunConfiguration configuration) throws RuntimeConfigurationWarning {
    if (configuration.isAlternativeJrePathEnabled()) {
        checkAlternativeJRE(configuration.getAlternativeJrePath());
    }
}
 
Example #8
Source File: AlternativeJreValidator.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public static void checkAlternativeJRE(@Nullable String jrePath) throws RuntimeConfigurationWarning {
    if (StringUtil.isEmpty(jrePath) ||
            ProjectJdkTable.getInstance().findJdk(jrePath) == null && !JdkUtil.checkForJre(jrePath)) {
        throw new RuntimeConfigurationWarning(ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jrePath));
    }
}
 
Example #9
Source File: ProgramParametersUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void checkWorkingDirectoryExist(CommonProgramRunConfigurationParameters configuration, Project project, Module module)
  throws RuntimeConfigurationWarning {
  new ProgramParametersConfigurator().checkWorkingDirectoryExist(configuration, project, module);
}