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.");
}
}
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.");
}
}
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;
}
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;
}
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()));
}
}
}
Aggregations