jdk-auto: use non-modal notifications for compile actions, IDEA-253119, IDEA-240999 + cleanup

GitOrigin-RevId: 255b41fae7b851d92da2ca1e3c7a2d28c1acb475
This commit is contained in:
Eugene Petrenko
2020-10-16 21:22:04 +02:00
committed by intellij-monorepo-bot
parent b030532e96
commit 61d2e29d82
2 changed files with 11 additions and 8 deletions

View File

@@ -1,14 +1,18 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.compiler.impl
import com.intellij.build.BuildContentManager
import com.intellij.notification.Notification
import com.intellij.notification.NotificationAction
import com.intellij.notification.NotificationGroupManager
import com.intellij.notification.NotificationType
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.invokeLater
import com.intellij.openapi.compiler.JavaCompilerBundle
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService
import com.intellij.openapi.util.NlsContexts.NotificationContent
@@ -69,6 +73,11 @@ class CompileDriverNotifications(
* This wrapper helps to make sure we have only one active unresolved notification per project
*/
fun showNotification() {
if (ApplicationManager.getApplication().isUnitTestMode) {
thisLogger().error("" + baseNotification.content)
return
}
if (!isShown.compareAndSet(false, true)) return
val showNotification = Runnable {
@@ -80,13 +89,7 @@ class CompileDriverNotifications(
baseNotification.notify(project)
}
// activate the tool window before showing the notification
val toolWindow = notificationGroup.toolWindowId?.let(ToolWindowManager.getInstance(project)::getToolWindow)
if (toolWindow != null) {
toolWindow.show(showNotification)
} else {
showNotification.run()
}
showNotification.run()
}
}
}

View File

@@ -39,7 +39,7 @@ java.compiler.description=Java Compiler
rmi.compiler.description=RMI Compiler
error.jdk.not.specified=The SDK is not specified for {0,choice, 1#module|2#modules\n} {1}
error.jdk.module.names.overflow.element.ellipsis=...
dialog.message.error.jdk.not.specified.with.fixSuggestion=SDK is not specified or corrupted<br/>for {0} {1,choice, 1#module|2#modules}. Resolve the following SDKs automatically?
dialog.message.error.jdk.not.specified.with.fixSuggestion=SDK is not specified or corrupted for {0} {1,choice, 1#module|2#modules}. Resolve the following SDKs automatically?
dialog.message.error.jdk.not.specified.with.noFix=Manual configuration is still required for:
dialog.message.action.apply.fix=Fix automatically
error.output.not.specified=The output path is not specified for {0,choice, 1#module|2#modules\n} {1}