From a3f4416519a5d2441565e4fe02d52288fe13af08 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 4 Feb 2021 19:05:51 +0100 Subject: [PATCH] made cpu snapshot notification action dumb-aware GitOrigin-RevId: 949ebc0c93681a5fcb6f2219b7d40f76eec3352a --- .../intellij/compiler/server/BuildManager.java | 16 ++++++++-------- .../messages/JavaCompilerBundle.properties | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 0d18073de4a7..525e29d0da16 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -28,7 +28,6 @@ import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; import com.intellij.openapi.Disposable; -import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.application.*; @@ -101,8 +100,7 @@ import org.jetbrains.jps.incremental.Utils; import org.jetbrains.jps.incremental.storage.ProjectStamps; import org.jetbrains.jps.model.java.compiler.JavaCompilers; -import javax.tools.JavaCompiler; -import javax.tools.ToolProvider; +import javax.tools.*; import java.awt.*; import java.io.File; import java.io.IOException; @@ -1458,13 +1456,15 @@ public final class BuildManager implements Disposable { @Override public void buildFinished(@NotNull Project project, @NotNull UUID sessionId, boolean isAutomake) { busConnection.disconnect(); - File snapshotDir = new File(SystemProperties.getUserHome(), "snapshots"); - Notification notification = - new Notification("Build Profiler", JavaCompilerBundle.message("notification.title.cpu.snapshot.build.has.been.captured"), "", NotificationType.INFORMATION); - notification.addAction(new AnAction(JavaCompilerBundle.message("action.show.snapshot.location.text")) { + final Notification notification = new Notification( + "Build Profiler", + JavaCompilerBundle.message("notification.title.cpu.snapshot.build.has.been.captured"), + "", NotificationType.INFORMATION + ); + notification.addAction(new DumbAwareAction(JavaCompilerBundle.message("action.show.snapshot.location.text")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { - RevealFileAction.openDirectory(snapshotDir); + RevealFileAction.openDirectory(new File(SystemProperties.getUserHome(), "snapshots")); notification.expire(); } }); diff --git a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties index d8e4218c5a83..cc5bd4646ea5 100644 --- a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties +++ b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties @@ -316,7 +316,7 @@ element.with.manifest.label.manifest.file=Manifest &File: notification.group.title.jps.cannot.start.compiler=Cannot start compilation notification.action.jps.open.configuration.dialog=Configure... notification.title.jps.cannot.start.compiler=Cannot start compiler -notification.title.cpu.snapshot.build.has.been.captured=CPU snapshot of build has been captured +notification.title.cpu.snapshot.build.has.been.captured=Build CPU snapshot has been captured action.show.snapshot.location.text=Show Snapshot Location dialog.message.failed.to.determine.host.ip.for.wsl.jdk=Failed to determine host IP for WSL JDK progress.preparing.wsl.build.environment=Preparing WSL build environment...