Search in sources :

Example 56 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project flutter-intellij by flutter.

the class SdkAttachConfig method checkRunnable.

private void checkRunnable(@NotNull Project project) throws RuntimeConfigurationError {
    final DartSdk sdk = DartPlugin.getDartSdk(project);
    if (sdk == null) {
        throw new RuntimeConfigurationError(FlutterBundle.message("dart.sdk.is.not.configured"), () -> DartConfigurable.openDartSettings(project));
    }
    final MainFile.Result main = MainFile.verify(getFields().getFilePath(), project);
    if (!main.canLaunch()) {
        throw new RuntimeConfigurationError(main.getError());
    }
    if (PubRoot.forDirectory(main.get().getAppDir()) == null) {
        throw new RuntimeConfigurationError("Entrypoint isn't within a Flutter pub root");
    }
}
Also used : DartSdk(com.jetbrains.lang.dart.sdk.DartSdk) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 57 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project flutter-intellij by flutter.

the class BazelTestFields method checkRunnable.

/**
 * Reports an error in the run config that the user should correct.
 * <p>
 * This will be called while the user is typing into a non-template run config.
 * (See RunConfiguration.checkConfiguration.)
 *
 * @throws RuntimeConfigurationError for an error that that the user must correct before running.
 */
void checkRunnable(@NotNull final Project project) throws RuntimeConfigurationError {
    // The UI only shows one error message at a time.
    // The order we do the checks here determines priority.
    final DartSdk sdk = DartPlugin.getDartSdk(project);
    if (sdk == null) {
        throw new RuntimeConfigurationError(FlutterBundle.message("dart.sdk.is.not.configured"), () -> DartConfigurable.openDartSettings(project));
    }
    getScope(project).checkRunnable(this, project);
}
Also used : DartSdk(com.jetbrains.lang.dart.sdk.DartSdk) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Aggregations

RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)57 VirtualFile (com.intellij.openapi.vfs.VirtualFile)22 Test (org.junit.Test)16 Module (com.intellij.openapi.module.Module)10 ExecutionException (com.intellij.execution.ExecutionException)7 File (java.io.File)7 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)6 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 PsiFile (com.intellij.psi.PsiFile)5 NotNull (org.jetbrains.annotations.NotNull)5 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)4 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)4 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Project (com.intellij.openapi.project.Project)4 Sdk (com.intellij.openapi.projectRoots.Sdk)4 CommandLineTokenizer (com.intellij.execution.configurations.CommandLineTokenizer)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 JSFile (com.intellij.lang.javascript.psi.JSFile)3 PsiElement (com.intellij.psi.PsiElement)3 UserSpecifiedPathDeploymentSource (com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource)2