From d16b6f98745c336dec158f55569c3d29aa2b4d4f Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 8 Aug 2018 16:06:57 +0300 Subject: [PATCH] Internal action for showing Kotlin code style status (KT-23400) Need this to monitor different IDE actions results. Commit can be dropped after transition to new code style settings is finished. --- idea/src/META-INF/plugin.xml | 3 +++ idea/src/META-INF/plugin.xml.173 | 3 +++ idea/src/META-INF/plugin.xml.181 | 3 +++ idea/src/META-INF/plugin.xml.183 | 3 +++ idea/src/META-INF/plugin.xml.as31 | 3 +++ idea/src/META-INF/plugin.xml.as32 | 3 +++ idea/src/META-INF/plugin.xml.as33 | 3 +++ .../KotlinFormattingSettingsStatusAction.kt | 25 +++++++++++++++++++ 8 files changed, 46 insertions(+) create mode 100644 idea/src/org/jetbrains/kotlin/idea/actions/internal/KotlinFormattingSettingsStatusAction.kt diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 2e44f550033..77000e98e68 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -171,6 +171,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/META-INF/plugin.xml.173 b/idea/src/META-INF/plugin.xml.173 index 0393cedee1e..6665a9f170f 100644 --- a/idea/src/META-INF/plugin.xml.173 +++ b/idea/src/META-INF/plugin.xml.173 @@ -170,6 +170,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/META-INF/plugin.xml.181 b/idea/src/META-INF/plugin.xml.181 index 6406f7c4811..e8891d74c87 100644 --- a/idea/src/META-INF/plugin.xml.181 +++ b/idea/src/META-INF/plugin.xml.181 @@ -170,6 +170,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/META-INF/plugin.xml.183 b/idea/src/META-INF/plugin.xml.183 index c01275bb081..334613f0dc3 100644 --- a/idea/src/META-INF/plugin.xml.183 +++ b/idea/src/META-INF/plugin.xml.183 @@ -171,6 +171,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/META-INF/plugin.xml.as31 b/idea/src/META-INF/plugin.xml.as31 index c0a8574cbb1..6c8f0c43711 100644 --- a/idea/src/META-INF/plugin.xml.as31 +++ b/idea/src/META-INF/plugin.xml.as31 @@ -170,6 +170,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/META-INF/plugin.xml.as32 b/idea/src/META-INF/plugin.xml.as32 index 18441aa688a..525012a881a 100644 --- a/idea/src/META-INF/plugin.xml.as32 +++ b/idea/src/META-INF/plugin.xml.as32 @@ -170,6 +170,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/META-INF/plugin.xml.as33 b/idea/src/META-INF/plugin.xml.as33 index 24f97fa01dc..a3032e72ad8 100644 --- a/idea/src/META-INF/plugin.xml.as33 +++ b/idea/src/META-INF/plugin.xml.as33 @@ -171,6 +171,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/KotlinFormattingSettingsStatusAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/KotlinFormattingSettingsStatusAction.kt new file mode 100644 index 00000000000..4c458c4dceb --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/KotlinFormattingSettingsStatusAction.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.actions.internal + +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.ui.Messages +import org.jetbrains.kotlin.idea.formatter.KotlinFormatterUsageCollector + +class KotlinFormattingSettingsStatusAction : AnAction() { + override fun actionPerformed(e: AnActionEvent?) { + val project = e?.project ?: return + + val formatterKind = KotlinFormatterUsageCollector.getKotlinFormatterKind(project) + + Messages.showInfoMessage( + project, + "formatterKind = $formatterKind", + "Kotlin Formatter Settings" + ) + } +}