if (files.length == 0)
return true;
Set<Module> modules = new HashSet<Module>();
for (VirtualFile file : files) {
Module module = DeclarationPosition.getModule(project, file);
if (module != null) {
modules.add(module);
}
}
Set<Module> noGhcModules = new HashSet<Module>();
for (Module module : modules) {
if (!isAcceptableModuleType(module))
continue;
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk == null || !(sdk.getSdkType() instanceof HaskellSdkType)) {
noGhcModules.add(module);
}
}
if (!noGhcModules.isEmpty()) {
if (noGhcModules.size() == 1) {
Module module = noGhcModules.iterator().next();
Messages.showErrorDialog(
project,
MessageFormat.format("Cannot compile Haskell files.\nPlease set up GHC for module ''{0}''.", module.getName()),
"Cannot Compile"
);
} else {
StringBuilder buf = new StringBuilder();
int i = 0;
for (Module module : noGhcModules) {
if (i > 0)
buf.append(", ");
buf.append(module.getName());
i++;
}
Messages.showErrorDialog(
project,
MessageFormat.format("Cannot compile Haskell files.\nPlease set up GHC for modules ''{0}''.", buf.toString()),