use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class FlexUnitRunnerParameters method doCheck.
private void doCheck(final Project project, final Pair<Module, FlexBuildConfiguration> moduleAndBC) throws RuntimeConfigurationError {
if (DumbService.getInstance(project).isDumb())
return;
final FlexBuildConfiguration bc = moduleAndBC.second;
final Sdk sdk = bc.getSdk();
if (sdk == null) {
throw new RuntimeConfigurationError(FlexCommonBundle.message("sdk.not.set.for.bc.0.of.module.1", bc.getName(), moduleAndBC.first.getName()));
}
switch(bc.getTargetPlatform()) {
case Web:
break;
case Desktop:
FlashRunnerParameters.checkAdlAndAirRuntime(sdk);
if (bc.getOutputType() == OutputType.Application) {
FlashRunnerParameters.checkCustomDescriptor(bc.getAirDesktopPackagingOptions(), getBCName(), getModuleName());
}
break;
case Mobile:
FlashRunnerParameters.checkAdlAndAirRuntime(sdk);
switch(myAppDescriptorForEmulator) {
case Android:
if (bc.getOutputType() == OutputType.Application) {
FlashRunnerParameters.checkCustomDescriptor(bc.getAndroidPackagingOptions(), getBCName(), getModuleName());
}
break;
case IOS:
if (bc.getOutputType() == OutputType.Application) {
FlashRunnerParameters.checkCustomDescriptor(bc.getIosPackagingOptions(), getBCName(), getModuleName());
}
break;
}
break;
}
final FlexUnitSupport support = FlexUnitSupport.getSupport(bc, moduleAndBC.first);
if (support == null) {
throw new RuntimeConfigurationError(FlexBundle.message("flexunit.not.found.for.bc", bc.getName()));
}
if (!support.flexUnit4Present && bc.isPureAs()) {
throw new RuntimeConfigurationError(FlexBundle.message("cant.execute.flexunit1.for.pure.as.bc"));
}
final GlobalSearchScope searchScope = FlexUtils.getModuleWithDependenciesAndLibrariesScope(moduleAndBC.first, bc, true);
switch(getScope()) {
case Class:
getClassToTest(getClassName(), searchScope, support, true);
break;
case Method:
final JSClass classToTest = getClassToTest(getClassName(), searchScope, support, false);
if (StringUtil.isEmpty(getMethodName())) {
throw new RuntimeConfigurationError(FlexBundle.message("no.test.method.specified"));
}
final JSFunction methodToTest = classToTest.findFunctionByNameAndKind(getMethodName(), JSFunction.FunctionKind.SIMPLE);
if (methodToTest == null || !support.isTestMethod(methodToTest)) {
throw new RuntimeConfigurationError(FlexBundle.message("method.not.valid", getMethodName()));
}
break;
case Package:
if (!JSUtils.packageExists(getPackageName(), searchScope)) {
throw new RuntimeConfigurationError(FlexBundle.message("package.not.valid", getPackageName()));
}
break;
default:
assert false : "Unknown scope: " + getScope();
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class FlexUnitRunConfigurationForm method createUIComponents.
private void createUIComponents() {
myBCCombo = new BCCombo(myProject);
myWhatToTestForm = new WhatToTestForm(myProject, () -> {
final Module module = myBCCombo.getModule();
if (module != null)
return module;
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
}, () -> {
final FlexBuildConfiguration bc = myBCCombo.getBC();
if (bc == null)
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
final FlexUnitSupport support = FlexUnitSupport.getSupport(bc, myBCCombo.getModule());
if (support != null)
return support;
throw new RuntimeConfigurationError(FlexBundle.message("flexunit.not.found.for.bc", bc.getName()));
});
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class JstdRunConfigurationVerifier method verifyJSFilePath.
private static void verifyJSFilePath(@NotNull JstdRunSettings runSettings) throws RuntimeConfigurationError {
String fileStr = runSettings.getJsFilePath();
if (fileStr.trim().isEmpty()) {
throw new RuntimeConfigurationError("JavaScript file name is empty.");
}
File configFile = new File(fileStr);
if (!configFile.exists()) {
throw new RuntimeConfigurationError("JavaScript 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 JavaScript file correctly.");
}
}
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.");
}
}
Aggregations