private void validateEncoding(ModuleChunk chunk, String chunkPresentableName) { final CompilerEncodingService es = CompilerEncodingService.getInstance(myProject); Charset charset = null; for (Module module : chunk.getModules()) { final Charset moduleCharset = es.getPreferredModuleEncoding(module); if (charset == null) { charset = moduleCharset; } else { if (!Comparing.equal(charset, moduleCharset)) { // warn user final Charset chunkEncoding = CompilerEncodingService.getPreferredModuleEncoding(chunk); final StringBuilder message = new StringBuilder(); message.append("Modules in chunk ["); message.append(chunkPresentableName); message.append("] configured to use different encodings.\n"); if (chunkEncoding != null) { message .append("\"") .append(chunkEncoding.name()) .append("\" encoding will be used to compile the chunk"); } else { message.append("Default compiler encoding will be used to compile the chunk"); } myCompileContext.addMessage( CompilerMessageCategory.INFORMATION, message.toString(), null, -1, -1); break; } } } }
private boolean isJDKChanged(final Sdk newJDK) { if (mySdk == null && newJDK == null) return false; return mySdk == null || newJDK == null || !Comparing.equal(mySdk.getVersionString(), newJDK.getVersionString()); }