1
0
mirror of https://github.com/chylex/IntelliJ-Rainbow-Brackets.git synced 2025-04-11 03:15:49 +02:00

hide update notification on any click

(cherry picked from commit 8c5153bcb4d4c0eaf5def5645b2c76778e5095e8)
This commit is contained in:
张志豪 2020-09-18 17:50:20 +08:00
parent 4508e5f519
commit f78cc55c67
3 changed files with 14 additions and 3 deletions
src/main
kotlin/com/github/izhangzhihao/rainbow/brackets
resources/META-INF

View File

@ -2,6 +2,8 @@ package com.github.izhangzhihao.rainbow.brackets
import com.intellij.notification.*
import com.intellij.notification.impl.NotificationsManagerImpl
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.popup.Balloon
import com.intellij.openapi.wm.WindowManager
@ -9,6 +11,14 @@ import com.intellij.ui.BalloonLayoutData
import com.intellij.ui.awt.RelativePoint
import java.awt.Point
class ApplicationServicePlaceholder : Disposable {
override fun dispose() = Unit
companion object {
val INSTANCE: ApplicationServicePlaceholder = ServiceManager.getService(ApplicationServicePlaceholder::class.java)
}
}
fun createNotification(title: String, content: String, displayId: String,
type: NotificationType, listener: NotificationListener): Notification {
val group = NotificationGroup(
@ -32,9 +42,9 @@ fun showFullNotification(project: Project, notification: Notification) {
val balloon = NotificationsManagerImpl.createBalloon(frame,
notification,
true, // showCallout
false, // hideOnClickOutside
true, // hideOnClickOutside
BalloonLayoutData.fullContent(),
project)
ApplicationServicePlaceholder.INSTANCE)
balloon.show(target, Balloon.Position.atLeft)
} catch (e: Exception) {
notification.notify(project)

View File

@ -4,7 +4,7 @@ import com.github.izhangzhihao.rainbow.brackets.RainbowHighlighter
import com.intellij.openapi.editor.colors.EditorColorsListener
import com.intellij.openapi.editor.colors.EditorColorsScheme
class RainbowColorsSchemeListener : EditorColorsListener {
class RainbowColorsSchemeListener : EditorColorsListener {
override fun globalSchemeChange(scheme: EditorColorsScheme?) {
scheme?.let { RainbowHighlighter.fixHighlighting(it) }

View File

@ -658,6 +658,7 @@
<postStartupActivity implementation="com.github.izhangzhihao.rainbow.brackets.RainbowUpdateNotifyActivity"/>
<errorHandler implementation="com.github.izhangzhihao.rainbow.brackets.util.GitHubErrorReporter"/>
<highlightingPassFactory implementation="com.github.izhangzhihao.rainbow.brackets.indents.RainbowIndentsPassFactory"/>
<applicationService serviceImplementation="com.github.izhangzhihao.rainbow.brackets.ApplicationServicePlaceholder" id="ApplicationServicePlaceholder"/>
</extensions>
<applicationListeners>