diff --git a/build.gradle.kts b/build.gradle.kts index 9b9c32f..c76d91e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -228,8 +228,8 @@ tasks { } patchPluginXml { - sinceBuild.set("233.0") - untilBuild.set("233.*") + sinceBuild.set("242.0") + untilBuild.set("242.*") val latestChangelog = try { changelog.getUnreleased() } catch (_: MissingVersionException) { diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/SuppressEfCoreToolsInstallation.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/SuppressEfCoreToolsInstallation.kt new file mode 100644 index 0000000..9e2334e --- /dev/null +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/SuppressEfCoreToolsInstallation.kt @@ -0,0 +1,15 @@ +package com.jetbrains.rider.plugins.efcore.features.eftools + +import com.intellij.notification.Notification +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.jetbrains.rider.plugins.efcore.EfCoreUiBundle +import com.jetbrains.rider.plugins.efcore.state.CommonOptionsStateService + +class SuppressEfCoreToolsInstallation(private val notification : Notification) : AnAction(EfCoreUiBundle.message("action.install.ignore")) { + private val commonOptionsStateService by lazy { CommonOptionsStateService.getInstance() } + override fun actionPerformed(actionEvent: AnActionEvent) { + commonOptionsStateService.setProjectToolsInstallationSupressed(true) + this.notification.hideBalloon() + } +} \ No newline at end of file diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/startup/EfCoreStartupListener.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/startup/EfCoreStartupListener.kt index 2a35298..ed97805 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/startup/EfCoreStartupListener.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/startup/EfCoreStartupListener.kt @@ -9,24 +9,32 @@ import com.jetbrains.rd.util.lifetime.Lifetime import com.jetbrains.rider.plugins.efcore.EfCoreUiBundle import com.jetbrains.rider.plugins.efcore.KnownNotificationGroups import com.jetbrains.rider.plugins.efcore.features.eftools.InstallDotnetEfAction +import com.jetbrains.rider.plugins.efcore.features.eftools.SuppressEfCoreToolsInstallation import com.jetbrains.rider.plugins.efcore.rd.RiderEfCoreModel +import com.jetbrains.rider.plugins.efcore.state.CommonOptionsStateService @Suppress("UnstableApiUsage") class EfCoreStartupListener : SolutionExtListener { + private val commonOptionsStateService by lazy { CommonOptionsStateService.getInstance() } override fun extensionCreated(lifetime: Lifetime, session: ClientProjectSession, model: RiderEfCoreModel) { - model.onMissingEfCoreToolsDetected.set { _, unit -> - NotificationGroupManager - .getInstance() - .getNotificationGroup(KnownNotificationGroups.efCore) - .createNotification( - EfCoreUiBundle.message("notification.title.ef.core.tools.required"), - EfCoreUiBundle.message("notification.content.ef.core.tools.are.required.to.execute.this.action"), - NotificationType.WARNING - ) - .addAction(InstallDotnetEfAction()) - .notify(session.project) + if(!commonOptionsStateService.getProjectToolsInstallationSupressed()) { + model.onMissingEfCoreToolsDetected.set { _, unit -> + NotificationGroupManager + .getInstance() + .getNotificationGroup(KnownNotificationGroups.efCore) + .createNotification( + EfCoreUiBundle.message("notification.title.ef.core.tools.required"), + EfCoreUiBundle.message("notification.content.ef.core.tools.are.required.to.execute.this.action"), + NotificationType.WARNING + ) + .addAction(InstallDotnetEfAction()) + .apply{ + addAction(SuppressEfCoreToolsInstallation(this)) + } + .notify(session.project) - RdTask.fromResult(unit) + RdTask.fromResult(unit) + } } } } \ No newline at end of file diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsState.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsState.kt index 7cba1f4..ff3ab22 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsState.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsState.kt @@ -4,4 +4,5 @@ class CommonOptionsState { var solutionLevelOptions: MutableMap = mutableMapOf() var migrationsToStartupProjects: MutableMap = mutableMapOf() var startupToMigrationsProjects: MutableMap = mutableMapOf() + var toolsInstallationSupressed: Boolean = false } diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsStateService.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsStateService.kt index 9657ef3..8e9e46a 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsStateService.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/state/CommonOptionsStateService.kt @@ -59,4 +59,11 @@ class CommonOptionsStateService : PersistentStateComponent { myState.solutionLevelOptions[MIGRATIONS_PROJECT_KEY] = migrationsProjectId.toString() myState.solutionLevelOptions[STARTUP_PROJECT_KEY] = startupProjectId.toString() } + + fun setProjectToolsInstallationSupressed(newState : Boolean) { + myState.toolsInstallationSupressed = newState + } + fun getProjectToolsInstallationSupressed() : Boolean { + return myState.toolsInstallationSupressed + } } \ No newline at end of file diff --git a/src/rider/main/resources/messages/EfCoreUiBundle.properties b/src/rider/main/resources/messages/EfCoreUiBundle.properties index 922247a..9818f6d 100644 --- a/src/rider/main/resources/messages/EfCoreUiBundle.properties +++ b/src/rider/main/resources/messages/EfCoreUiBundle.properties @@ -152,6 +152,8 @@ tab.ef.core.command=EF Core Command # # Install EF Core tools action.install.text=Install +#Ignore notification of installation EF Core tools +action.install.ignore=Don't show again ef.core.global.tools.have.been.successfully.installed=EF Core global tools have been successfully installed progress.title.getting.dotnet.ef.version=Getting dotnet-ef version\u2026 notification.content.ef.core.tools.are.required.to.execute.this.action=To use EF Core in the IDE, install dotnet-ef as a global tool