@Override
protected RunContentDescriptor doExecute(Project project,
RunProfileState state,
RunContentDescriptor contentToReuse,
ExecutionEnvironment env) throws ExecutionException {
final HaxeApplicationConfiguration configuration = (HaxeApplicationConfiguration)env.getRunProfile();
final Module module = configuration.getConfigurationModule().getModule();
final Executor executor = env.getExecutor();
if (module == null) {
throw new ExecutionException(HaxeBundle.message("no.module.for.run.configuration", configuration.getName()));
}
final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);
final boolean notHXCPP = settings.getNmeTarget() != NMETarget.WINDOWS &&
settings.getNmeTarget() != NMETarget.LINUX &&
settings.getNmeTarget() != NMETarget.MAC &&
settings.getNmeTarget() != NMETarget.LINUX64 &&
settings.getNmeTarget() != NMETarget.ANDROID &&
settings.getNmeTarget() != NMETarget.IOS;
if (settings.getHaxeTarget() != HaxeTarget.FLASH && settings.getNmeTarget() != NMETarget.FLASH && notHXCPP) {
throw new ExecutionException(HaxeBundle.message("haxe.proper.debug.targets"));
}
if (settings.isUseNmmlToBuild() && settings.getNmeTarget() != NMETarget.FLASH) {
boolean runInTest = settings.getNmeTarget() == NMETarget.ANDROID || settings.getNmeTarget() == NMETarget.IOS;
return runHXCPP(project, module, env, executor, contentToReuse, runInTest);
}
// flash only
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.intellij.flex"));
if (plugin == null) {
throw new ExecutionException(HaxeBundle.message("install.flex.plugin"));
}
if (!plugin.isEnabled()) {
throw new ExecutionException(HaxeBundle.message("enable.flex.plugin"));
}
String flexSdkName = settings.getFlexSdkName();
if (StringUtil.isEmpty(flexSdkName)) {
throw new ExecutionException(HaxeBundle.message("flex.sdk.not.specified"));
}
if (settings.isUseNmmlToBuild() && settings.getNmeTarget() == NMETarget.FLASH) {
return HaxeFlashDebuggingUtil.getNMEDescriptor(this, module, contentToReuse, env, executor, flexSdkName);
}
if (settings.isUseOpenFLToBuild() && settings.getOpenFLTarget() == OpenFLTarget.FLASH) {
return HaxeFlashDebuggingUtil.getOpenFLDescriptor(this, module, contentToReuse, env, executor, flexSdkName);
}
return HaxeFlashDebuggingUtil.getDescriptor(this, module, contentToReuse, env, configuration.getCustomFileToLaunchPath(), flexSdkName);
}