Search in sources :

Example 51 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij by bazelbuild.

the class BlazeIntellijPluginConfiguration method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    super.checkConfiguration();
    Label label = getTarget();
    if (label == null) {
        throw new RuntimeConfigurationError("Select a target to run");
    }
    TargetInfo target = TargetFinder.findTargetInfo(getProject(), label);
    if (target == null) {
        throw new RuntimeConfigurationError("The selected target does not exist.");
    }
    if (!IntellijPluginRule.isPluginTarget(target)) {
        throw new RuntimeConfigurationError("The selected target is not an intellij_plugin");
    }
    if (!IdeaJdkHelper.isIdeaJdk(pluginSdk)) {
        throw new RuntimeConfigurationError("Select an IntelliJ Platform Plugin SDK");
    }
}
Also used : TargetInfo(com.google.idea.blaze.base.dependencies.TargetInfo) Label(com.google.idea.blaze.base.model.primitives.Label) JLabel(javax.swing.JLabel) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 52 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij by bazelbuild.

the class BlazeCommandRunConfiguration method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    // Our handler check is not valid when we don't have BlazeProjectData.
    if (BlazeProjectDataManager.getInstance(getProject()).getBlazeProjectData() == null) {
        throw new RuntimeConfigurationError("Configuration cannot be run until project has been synced.");
    }
    if (Strings.isNullOrEmpty(targetPattern)) {
        throw new RuntimeConfigurationError(String.format("You must specify a %s target expression.", Blaze.buildSystemName(getProject())));
    }
    if (!targetPattern.startsWith("//")) {
        throw new RuntimeConfigurationError("You must specify the full target expression, starting with //");
    }
    String error = TargetExpression.validate(targetPattern);
    if (error != null) {
        throw new RuntimeConfigurationError(error);
    }
    for (BeforeRunTask task : RunManagerCompatUtils.getBeforeRunTasks(this)) {
        if (task.getProviderId().equals(BlazeBeforeRunTaskProvider.ID) && !task.isEnabled()) {
            throw new RuntimeConfigurationError(String.format("Invalid run configuration: the %s before run task is missing. Please re-run sync " + "to add it back", Blaze.buildSystemName(getProject())));
        }
    }
    handler.checkConfiguration();
}
Also used : BeforeRunTask(com.intellij.execution.BeforeRunTask) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 53 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationWithMain method checkFileConfiguration.

protected void checkFileConfiguration() throws RuntimeConfigurationError {
    VirtualFile file = findFile(getFilePath());
    if (file == null) {
        throw new RuntimeConfigurationError("Main file is not specified");
    }
    PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
    if (!(psiFile instanceof GoFile)) {
        throw new RuntimeConfigurationError("Main file is invalid");
    }
    if (!GoRunUtil.isMainGoFile(psiFile)) {
        throw new RuntimeConfigurationError("Main file has non-main package or doesn't contain main function");
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GoFile(com.goide.psi.GoFile) PsiFile(com.intellij.psi.PsiFile) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Aggregations

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