-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: grazie pro incompatibility notification
- Loading branch information
1 parent
91944ab
commit c6e6dfd
Showing
8 changed files
with
70 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
src/main/kotlin/ru/ozon/ideplugin/kelp/ThemeQuickTypeAction.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/kotlin/ru/ozon/ideplugin/kelp/pluginConfig/GrazieProNotification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ru.ozon.ideplugin.kelp.pluginConfig | ||
|
||
import com.intellij.ide.plugins.PluginManagerCore | ||
import com.intellij.notification.NotificationGroupManager | ||
import com.intellij.notification.NotificationType | ||
import com.intellij.openapi.application.invokeLater | ||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.extensions.PluginId | ||
import com.intellij.openapi.project.Project | ||
import ru.ozon.ideplugin.kelp.KelpBundle | ||
|
||
/** | ||
* [Issue](https://youtrack.jetbrains.com/issue/GRZ-4351) | ||
*/ | ||
@Service(Service.Level.PROJECT) | ||
class GrazieProNotification { | ||
private var notified = false | ||
|
||
fun notifyIfNeeded(project: Project, previousConfig: KelpConfig?, kelpConfig: KelpConfig) = invokeLater { | ||
if (!notified && | ||
kelpConfig.iconsRendering?.gutterEnabled == true && | ||
previousConfig?.iconsRendering?.gutterEnabled != true && | ||
isGrazieProPluginEnabled() | ||
) { | ||
NotificationGroupManager.getInstance() | ||
.getNotificationGroup(KelpBundle.message("grazieProNotificationGroup")) | ||
.createNotification( | ||
title = KelpBundle.message("grazieProNotificationTitle"), | ||
content = KelpBundle.message("grazieProNotificationMessage"), | ||
type = NotificationType.WARNING, | ||
) | ||
.notify(project) | ||
|
||
notified = true | ||
} | ||
} | ||
|
||
private fun isGrazieProPluginEnabled(): Boolean { | ||
val pluginId = PluginId.getId(GRAZIE_PRO_PLUGIN_ID) | ||
return PluginManagerCore.getPlugin(pluginId) != null && !PluginManagerCore.isDisabled(pluginId) | ||
} | ||
} | ||
|
||
private const val GRAZIE_PRO_PLUGIN_ID = "com.intellij.grazie.pro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters