project disposed check and consmetics

This commit is contained in:
Eugene Zhuravlev
2016-06-10 09:59:06 +02:00
parent 9f1fc46385
commit 77d6d3790c
@@ -32,7 +32,7 @@ import com.intellij.openapi.compiler.ex.CompilerPathsEx;
import com.intellij.openapi.deployment.DeploymentUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.module.LanguageLevelUtil;
import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -295,12 +295,14 @@ public class CompileDriver {
switch (eventType) {
case FILES_GENERATED:
final List<CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile> generated = event.getGeneratedFilesList();
final CompilationStatusListener publisher = messageBus.syncPublisher(CompilerTopics.COMPILATION_STATUS);
final CompilationStatusListener publisher = myProject.isDisposed()? messageBus.syncPublisher(CompilerTopics.COMPILATION_STATUS) : null;
Set<String> writtenArtifactOutputPaths = outputToArtifact != null ? new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY) : null;
for (CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile generatedFile : generated) {
final String root = FileUtil.toSystemIndependentName(generatedFile.getOutputRoot());
final String relativePath = FileUtil.toSystemIndependentName(generatedFile.getRelativePath());
publisher.fileGenerated(root, relativePath);
if (publisher != null) {
publisher.fileGenerated(root, relativePath);
}
if (outputToArtifact != null) {
Collection<Artifact> artifacts = outputToArtifact.get(root);
if (!artifacts.isEmpty()) {
@@ -508,7 +510,7 @@ public class CompileDriver {
messageType.toNotificationType(),
new MessagesActivationListener(compileContext)
).setImportant(false);
compileContext.getBuildSession().registerCloseAction(() -> notification.expire());
compileContext.getBuildSession().registerCloseAction(notification::expire);
notification.notify(myProject);
if (_status != ExitStatus.UP_TO_DATE && compileContext.getMessageCount(null) > 0) {
@@ -614,7 +616,7 @@ public class CompileDriver {
statusBar.setInfo("");
}
if (progressIndicator instanceof CompilerTask) {
ApplicationManager.getApplication().invokeLater(() -> ((CompilerTask)progressIndicator).showCompilerContent());
ApplicationManager.getApplication().invokeLater(((CompilerTask)progressIndicator)::showCompilerContent);
}
}
return true;
@@ -690,7 +692,7 @@ public class CompileDriver {
}
}
LanguageLevel moduleLanguageLevel = LanguageLevelUtil.getEffectiveLanguageLevel(module);
LanguageLevel moduleLanguageLevel = EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(module);
if (languageLevel == null) {
languageLevel = moduleLanguageLevel;
}