Search in sources :

Example 16 with RuntimeConfigurationError

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

the class JstdRunConfigurationVerifier method verifyConfigFile.

private static void verifyConfigFile(@NotNull JstdRunSettings runSettings) throws RuntimeConfigurationError {
    String fileStr = runSettings.getConfigFile();
    if (fileStr.trim().isEmpty()) {
        throw new RuntimeConfigurationError("Configuration file name is empty.");
    }
    File configFile = new File(fileStr);
    if (!configFile.exists()) {
        throw new RuntimeConfigurationError("Configuration file does not exist.");
    }
    if (configFile.isDirectory()) {
        throw new RuntimeConfigurationError("You have specified directory, but file was expected.");
    }
    if (!configFile.isFile()) {
        throw new RuntimeConfigurationError("Please specify configuration file correctly.");
    }
}
Also used : RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) JSFile(com.intellij.lang.javascript.psi.JSFile)

Example 17 with RuntimeConfigurationError

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

the class JstdRunConfigurationVerifier method verifyAllInDirectory.

private static void verifyAllInDirectory(@NotNull JstdRunSettings runSettings) throws RuntimeConfigurationError {
    String directory = runSettings.getDirectory();
    if (directory.trim().isEmpty()) {
        throw new RuntimeConfigurationError("Directory name is empty.");
    }
    File dirFile = new File(directory);
    if (!dirFile.exists()) {
        throw new RuntimeConfigurationError("Specified directory '" + directory + "' does not exist.");
    }
    if (dirFile.isFile()) {
        throw new RuntimeConfigurationError("You have specified file, but directory was expected.");
    }
    if (!dirFile.isDirectory()) {
        throw new RuntimeConfigurationError("Please specify directory correctly.");
    }
}
Also used : RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) JSFile(com.intellij.lang.javascript.psi.JSFile)

Example 18 with RuntimeConfigurationError

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

the class FlexBuildTargetScopeProvider method getModulesAndBCsToCompile.

static Collection<Pair<Module, FlexBuildConfiguration>> getModulesAndBCsToCompile(final CompileScope scope) throws ConfigurationException {
    final Collection<Pair<Module, FlexBuildConfiguration>> result = new HashSet<>();
    final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile = FlexResourceBuildTargetScopeProvider.getBCsToCompileForPackaging(scope);
    final RunConfiguration runConfiguration = CompileStepBeforeRun.getRunConfiguration(scope);
    if (modulesAndBCsToCompile != null) {
        for (Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCsToCompile) {
            if (!moduleAndBC.second.isSkipCompile()) {
                final FlexBuildConfiguration bcWithForcedDebugStatus = forceDebugStatus(moduleAndBC.first.getProject(), moduleAndBC.second);
                result.add(Pair.create(moduleAndBC.first, bcWithForcedDebugStatus));
                appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
            }
        }
    } else if (runConfiguration instanceof FlashRunConfiguration || runConfiguration instanceof FlexUnitRunConfiguration) {
        final BCBasedRunnerParameters params = runConfiguration instanceof FlashRunConfiguration ? ((FlashRunConfiguration) runConfiguration).getRunnerParameters() : ((FlexUnitRunConfiguration) runConfiguration).getRunnerParameters();
        final Pair<Module, FlexBuildConfiguration> moduleAndBC;
        final Ref<RuntimeConfigurationError> exceptionRef = new Ref<>();
        moduleAndBC = ApplicationManager.getApplication().runReadAction((NullableComputable<Pair<Module, FlexBuildConfiguration>>) () -> {
            try {
                return params.checkAndGetModuleAndBC(runConfiguration.getProject());
            } catch (RuntimeConfigurationError e) {
                exceptionRef.set(e);
                return null;
            }
        });
        if (!exceptionRef.isNull()) {
            throw new ConfigurationException(exceptionRef.get().getMessage(), FlexBundle.message("run.configuration.0", runConfiguration.getName()));
        }
        if (!moduleAndBC.second.isSkipCompile()) {
            result.add(moduleAndBC);
            appendBCDependencies(result, moduleAndBC.first, moduleAndBC.second);
        }
    } else {
        for (final Module module : scope.getAffectedModules()) {
            if (module.isDisposed() || ModuleType.get(module) != FlexModuleType.getInstance())
                continue;
            for (final FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
                if (!bc.isSkipCompile()) {
                    result.add(Pair.create(module, bc));
                }
            }
        }
    }
    return result;
}
Also used : BCBasedRunnerParameters(com.intellij.lang.javascript.flex.run.BCBasedRunnerParameters) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Ref(com.intellij.openapi.util.Ref) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) ConfigurationException(com.intellij.openapi.options.ConfigurationException) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) Pair(com.intellij.openapi.util.Pair)

Example 19 with RuntimeConfigurationError

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

the class DartTestRunningState method createConsole.

private static ConsoleView createConsole(@NotNull ExecutionEnvironment env) {
    final Project project = env.getProject();
    final DartRunConfiguration runConfiguration = (DartRunConfiguration) env.getRunProfile();
    final DartTestRunnerParameters runnerParameters = (DartTestRunnerParameters) runConfiguration.getRunnerParameters();
    final TestConsoleProperties testConsoleProperties = new DartConsoleProperties(runConfiguration, env);
    final ConsoleView consoleView = SMTestRunnerConnectionUtil.createConsole(DART_FRAMEWORK_NAME, testConsoleProperties);
    try {
        final VirtualFile dartFile = runnerParameters.getDartFileOrDirectory();
        consoleView.addMessageFilter(new DartConsoleFilter(project, dartFile));
        consoleView.addMessageFilter(new DartRelativePathsConsoleFilter(project, runnerParameters.computeProcessWorkingDirectory(project)));
        consoleView.addMessageFilter(new UrlFilter());
    } catch (RuntimeConfigurationError ignore) {
    /* can't happen because already checked */
    }
    Disposer.register(project, consoleView);
    return consoleView;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DartRelativePathsConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter) Project(com.intellij.openapi.project.Project) DartRunConfiguration(com.jetbrains.lang.dart.ide.runner.base.DartRunConfiguration) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) DartConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartConsoleFilter) UrlFilter(com.intellij.execution.filters.UrlFilter) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) TestConsoleProperties(com.intellij.execution.testframework.TestConsoleProperties)

Example 20 with RuntimeConfigurationError

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

the class FlashRunnerParameters method checkAdlAndAirRuntime.

public static void checkAdlAndAirRuntime(@NotNull final Sdk sdk) throws RuntimeConfigurationError {
    final String adlPath = FlexSdkUtils.getAdlPath(sdk);
    if (StringUtil.isEmpty(adlPath)) {
        throw new RuntimeConfigurationError(FlexBundle.message("adl.not.set.check.sdk.settings", sdk.getName()));
    }
    final VirtualFile adlFile = LocalFileSystem.getInstance().findFileByPath(adlPath);
    if (adlFile == null || adlFile.isDirectory()) {
        throw new RuntimeConfigurationError(sdk.getSdkType() instanceof FlexmojosSdkType ? FlexBundle.message("adl.not.found.check.sdk.settings", adlPath, sdk.getName()) : FlexBundle.message("adl.not.found.check.sdk.installation", adlPath, sdk.getName()));
    }
    if (sdk.getSdkType() instanceof FlexmojosSdkType) {
        final String airRuntimePath = FlexSdkUtils.getAirRuntimePathForFlexmojosSdk(sdk);
        if (StringUtil.isEmpty(airRuntimePath)) {
            throw new RuntimeConfigurationError(FlexBundle.message("air.runtime.not.set.check.sdk.settings", sdk.getName()));
        }
        final VirtualFile airRuntimeDir = LocalFileSystem.getInstance().findFileByPath(airRuntimePath);
        if (airRuntimeDir == null) {
            throw new RuntimeConfigurationError(FlexBundle.message("air.runtime.not.found.check.sdk.settings", airRuntimePath, sdk.getName()));
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FlexmojosSdkType(com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Aggregations

RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)23 VirtualFile (com.intellij.openapi.vfs.VirtualFile)16 Module (com.intellij.openapi.module.Module)7 File (java.io.File)7 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)4 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Sdk (com.intellij.openapi.projectRoots.Sdk)4 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 PsiFile (com.intellij.psi.PsiFile)3 NotNull (org.jetbrains.annotations.NotNull)3 ExecutionException (com.intellij.execution.ExecutionException)2 RunProfile (com.intellij.execution.configurations.RunProfile)2 XmlFile (com.intellij.psi.xml.XmlFile)2 Consumer (com.intellij.util.Consumer)2 DartRunConfigurationBase (com.jetbrains.lang.dart.ide.runner.base.DartRunConfigurationBase)2 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)2