diff --git a/gradle.properties b/gradle.properties index 3587d83..af70108 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ pluginGroup = com.keepersecurity.jetbrains pluginName = Keeper Security pluginRepositoryUrl = https://github.com/Keeper-Security/keeper-jetbrains-plugin # SemVer format -> https://semver.org -pluginVersion = 2.0.0 +pluginVersion = 2.0.1 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 243 diff --git a/src/main/kotlin/keepersecurity/action/KeeperGetSecretAction.kt b/src/main/kotlin/keepersecurity/action/KeeperGetSecretAction.kt index f02562c..8ca3864 100644 --- a/src/main/kotlin/keepersecurity/action/KeeperGetSecretAction.kt +++ b/src/main/kotlin/keepersecurity/action/KeeperGetSecretAction.kt @@ -1,11 +1,11 @@ package keepersecurity.action -import com.intellij.ide.plugins.PluginManagerCore import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.editor.Editor +import com.intellij.ide.plugins.PluginManager import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.progress.ProgressIndicator @@ -330,24 +330,19 @@ class KeeperGetSecretAction : AnAction("Get Keeper Secret") { } /** - * Detects HTTP Client request files via the FileType API. The `com.jetbrains.restClient` - * plugin is an optional dependency, so its classes are only on the classpath when it is - * loaded; the plugin check plus the try/catch keep the call safe on IDEs that do not bundle it. - */ + * Detects JetBrains HTTP Client request files by extension when the HTTP Client plugin is + * installed. Uses public [PluginManager.isPluginInstalled] (not Internal API + * [com.intellij.ide.plugins.PluginManagerCore.getPlugin]). The `$keeper` dynamic variable is + * registered only when optional `com.jetbrains.restClient` loads `keeper-http-client.xml`. + */ private fun isHttpClientRequestFile(editor: Editor): Boolean { val file: VirtualFile = FileDocumentManager.getInstance().getFile(editor.document) ?: return false if (!isHttpClientPluginEnabled()) return false - return try { - file.fileType == com.intellij.httpClient.http.request.HttpRequestFileType.INSTANCE - } catch (_: Throwable) { - false - } + return file.extension?.lowercase() in setOf("http", "rest") } - private fun isHttpClientPluginEnabled(): Boolean { - val descriptor = PluginManagerCore.getPlugin(PluginId.getId("com.jetbrains.restClient")) - return descriptor != null && descriptor.isEnabled - } + private fun isHttpClientPluginEnabled(): Boolean = + PluginManager.isPluginInstalled(PluginId.getId("com.jetbrains.restClient")) /** * Snippet for HTTP Client: no space after `{{` (see JetBrains HTTP Client variable docs). diff --git a/src/main/kotlin/keepersecurity/run/KeeperSecureRunConfigurationType.kt b/src/main/kotlin/keepersecurity/run/KeeperSecureRunConfigurationType.kt index fe83ae4..3c55c77 100644 --- a/src/main/kotlin/keepersecurity/run/KeeperSecureRunConfigurationType.kt +++ b/src/main/kotlin/keepersecurity/run/KeeperSecureRunConfigurationType.kt @@ -4,6 +4,7 @@ import com.intellij.execution.configurations.ConfigurationFactory import com.intellij.execution.configurations.ConfigurationTypeBase import com.intellij.execution.configurations.RunConfiguration import com.intellij.execution.configurations.RunConfigurationOptions +import com.intellij.execution.configurations.RunConfigurationSingletonPolicy import com.intellij.openapi.project.Project import com.intellij.icons.AllIcons @@ -27,6 +28,7 @@ class KeeperSecureRunConfigurationType : ConfigurationTypeBase( override fun getName(): String = "Run Keeper Securely" - override fun isConfigurationSingletonByDefault(): Boolean = false + override fun getSingletonPolicy(): RunConfigurationSingletonPolicy = + RunConfigurationSingletonPolicy.MULTIPLE_INSTANCE } } diff --git a/src/main/kotlin/keepersecurity/ui/KeeperListPickerDialog.kt b/src/main/kotlin/keepersecurity/ui/KeeperListPickerDialog.kt index 1ffa319..d8890a8 100644 --- a/src/main/kotlin/keepersecurity/ui/KeeperListPickerDialog.kt +++ b/src/main/kotlin/keepersecurity/ui/KeeperListPickerDialog.kt @@ -251,7 +251,7 @@ object KeeperListPickerDialog { } private fun nestedBadgeBackground(): Color = - JBUI.CurrentTheme.Link.linkColor().let { link -> + JBUI.CurrentTheme.Link.Foreground.ENABLED.let { link -> Color( (link.red + 255 * 4) / 5, (link.green + 255 * 4) / 5, @@ -260,6 +260,6 @@ object KeeperListPickerDialog { ) } - private fun nestedBadgeForeground(): Color = JBUI.CurrentTheme.Link.linkColor() + private fun nestedBadgeForeground(): Color = JBUI.CurrentTheme.Link.Foreground.ENABLED } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 6278d17..f394f8d 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -4,8 +4,6 @@ Keeper Security com.intellij.modules.platform - - com.intellij.modules.python com.jetbrains.restClient