use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.
the class BCBasedRunnerParameters method checkAndGetModuleAndBC.
public Pair<Module, FlexBuildConfiguration> checkAndGetModuleAndBC(final Project project) throws RuntimeConfigurationError {
if (myModuleName.isEmpty() || myBCName.isEmpty()) {
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
}
final Module module = ModuleManager.getInstance(project).findModuleByName(myModuleName);
if (module == null || !(ModuleType.get(module) instanceof FlexModuleType)) {
throw new RuntimeConfigurationError(FlexBundle.message("bc.not.specified"));
}
final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(module).findConfigurationByName(myBCName);
if (bc == null) {
throw new RuntimeConfigurationError(FlexBundle.message("module.does.not.contain.bc", myModuleName, myBCName));
}
final Sdk sdk = bc.getSdk();
if (sdk == null) {
throw new RuntimeConfigurationError(FlexCommonBundle.message("sdk.not.set.for.bc.0.of.module.1", bc.getName(), module.getName()));
}
return Pair.create(module, bc);
}
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");
}
}
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.");
}
}
Aggregations