From d252ac3db3a4feb5e8f4ee2f50a08673432d6b3d Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Sat, 3 Feb 2024 12:25:50 +0300 Subject: [PATCH] fix enum name --- .../org/move/cli/settings/MoveProjectSettingsService.kt | 2 +- .../ide/notifications/InvalidBlockchainCliConfiguration.kt | 2 +- .../NoMoveProjectDetectedNotificationProvider.kt | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/org/move/cli/settings/MoveProjectSettingsService.kt b/src/main/kotlin/org/move/cli/settings/MoveProjectSettingsService.kt index 030a7d5ab..6964880bf 100644 --- a/src/main/kotlin/org/move/cli/settings/MoveProjectSettingsService.kt +++ b/src/main/kotlin/org/move/cli/settings/MoveProjectSettingsService.kt @@ -36,7 +36,7 @@ interface MoveSettingsListener { enum class Blockchain { APTOS, SUI; - fun name(): String = if (this == APTOS) "Aptos" else "Sui" + override fun toString(): String = if (this == APTOS) "Aptos" else "Sui" } private const val settingsServiceName: String = "MoveProjectSettingsService_1" diff --git a/src/main/kotlin/org/move/ide/notifications/InvalidBlockchainCliConfiguration.kt b/src/main/kotlin/org/move/ide/notifications/InvalidBlockchainCliConfiguration.kt index f303fe1c4..1b19bc874 100644 --- a/src/main/kotlin/org/move/ide/notifications/InvalidBlockchainCliConfiguration.kt +++ b/src/main/kotlin/org/move/ide/notifications/InvalidBlockchainCliConfiguration.kt @@ -34,7 +34,7 @@ class InvalidBlockchainCliConfiguration(project: Project): MvEditorNotificationP } return EditorNotificationPanel().apply { - text = "${blockchain.name()} CLI path is not provided or invalid" + text = "$blockchain CLI path is not provided or invalid" createActionLabel("Configure") { project.showSettings() } diff --git a/src/main/kotlin/org/move/ide/notifications/NoMoveProjectDetectedNotificationProvider.kt b/src/main/kotlin/org/move/ide/notifications/NoMoveProjectDetectedNotificationProvider.kt index b1862c594..77aae3c2c 100644 --- a/src/main/kotlin/org/move/ide/notifications/NoMoveProjectDetectedNotificationProvider.kt +++ b/src/main/kotlin/org/move/ide/notifications/NoMoveProjectDetectedNotificationProvider.kt @@ -25,6 +25,7 @@ class NoMoveProjectDetectedNotificationProvider(project: Project): MvEditorNotif @Suppress("UnstableApiUsage") if (!project.isTrusted()) return null + val blockchain = project.blockchain val moveProjectsService = project.moveProjectsService // HACK: Reloads projects once on an opening of any Move file, if not yet reloaded. // It should be invoked somewhere else where it's more appropriate, @@ -39,7 +40,7 @@ class NoMoveProjectDetectedNotificationProvider(project: Project): MvEditorNotif if (moveProjectsService.allProjects.isEmpty()) { // no move projects available return EditorNotificationPanel().apply { - text = "No ${project.blockchain.name()} projects found" + text = "No $blockchain projects found" createActionLabel("Do not show again") { disableNotification(file) updateAllNotifications(project) @@ -49,7 +50,7 @@ class NoMoveProjectDetectedNotificationProvider(project: Project): MvEditorNotif if (moveProjectsService.findMoveProjectForFile(file) == null) { return EditorNotificationPanel().apply { - text = "File does not belong to any known ${project.blockchain.name()} project" + text = "File does not belong to any known $blockchain project" createActionLabel("Do not show again") { disableNotification(file) updateAllNotifications(project)