diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index f57d4662..b9b1d15c 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ wu.seal.tool.jsontokotlin JsonToKotlinClass - 1.6.2-beta + 1.6.2 Seal - + diff --git a/src/wu/seal/jsontokotlin/JsonToKotlinApplication.kt b/src/wu/seal/jsontokotlin/JsonToKotlinApplication.kt index 7f71b3e3..8d12f936 100644 --- a/src/wu/seal/jsontokotlin/JsonToKotlinApplication.kt +++ b/src/wu/seal/jsontokotlin/JsonToKotlinApplication.kt @@ -10,7 +10,7 @@ import wu.seal.jsontokotlin.feedback.sendHistoryActionInfo * Created by Seal.wu on 2017/8/21. */ -const val PLUGIN_VERSION = "1.6.1" +const val PLUGIN_VERSION = "1.6.2" class JsonToKotlinApplication : ApplicationComponent { diff --git a/src/wu/seal/jsontokotlin/feedback/Actions.kt b/src/wu/seal/jsontokotlin/feedback/Actions.kt index 8cade013..272bf030 100644 --- a/src/wu/seal/jsontokotlin/feedback/Actions.kt +++ b/src/wu/seal/jsontokotlin/feedback/Actions.kt @@ -11,6 +11,7 @@ import java.util.* const val ACTION_START = "action_start" const val ACTION_SUCCESS_COMPLETE = "action_success_complete" +const val ACTION_FORMAT_JSON = "action_format_json" data class StartAction( val uuid: String = UUID, @@ -26,4 +27,12 @@ data class SuccessCompleteAction( val actionType: String = ACTION_SUCCESS_COMPLETE, val time: String = Date().time.toString(), val daytime: String = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).format(Date()) +) + +data class FormatJSONAction( + val uuid: String = UUID, + val pluginVersion: String = PLUGIN_VERSION, + val actionType: String = ACTION_FORMAT_JSON, + val time: String = Date().time.toString(), + val daytime: String = SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).format(Date()) ) \ No newline at end of file diff --git a/src/wu/seal/jsontokotlin/ui/JsonInputDialog.kt b/src/wu/seal/jsontokotlin/ui/JsonInputDialog.kt index 18b7e31b..9b0bb593 100644 --- a/src/wu/seal/jsontokotlin/ui/JsonInputDialog.kt +++ b/src/wu/seal/jsontokotlin/ui/JsonInputDialog.kt @@ -9,6 +9,8 @@ import com.intellij.ui.components.JBLabel import com.intellij.ui.components.JBScrollPane import com.intellij.util.ui.JBDimension import com.intellij.util.ui.JBEmptyBorder +import wu.seal.jsontokotlin.feedback.FormatJSONAction +import wu.seal.jsontokotlin.feedback.sendActionInfo import wu.seal.jsontokotlin.utils.addComponentIntoVerticalBoxAlignmentLeft import java.awt.BorderLayout import java.awt.event.ActionEvent @@ -87,8 +89,8 @@ class JsonInputDialog(private val classsName: String, project: Project) : Messag val createScrollableTextComponent = createMyScrollableTextComponent() val jsonInputContainer = createLinearLayoutVertical() - jsonInputContainer.preferredSize = JBDimension(700, 400) - jsonInputContainer.border = JBEmptyBorder(5,0,5,5) + jsonInputContainer.preferredSize = JBDimension(700, 400) + jsonInputContainer.border = JBEmptyBorder(5, 0, 5, 5) val jsonTitle = JBLabel("JSON Text:") jsonTitle.border = JBEmptyBorder(5, 0, 5, 0) jsonInputContainer.addComponentIntoVerticalBoxAlignmentLeft(jsonTitle) @@ -117,7 +119,7 @@ class JsonInputDialog(private val classsName: String, project: Project) : Messag }) val settingContainer = JPanel() - settingContainer.border = JBEmptyBorder(0,5,5,7) + settingContainer.border = JBEmptyBorder(0, 5, 5, 7) val boxLayout = BoxLayout(settingContainer, BoxLayout.LINE_AXIS) settingContainer.layout = boxLayout settingContainer.add(settingButton) @@ -129,11 +131,11 @@ class JsonInputDialog(private val classsName: String, project: Project) : Messag } override fun createTextFieldComponent(): JTextComponent { - val jTextArea = JTextArea(15, 100) - jTextArea.preferredSize = JBDimension(700, 350) - jTextArea.lineWrap = true - jTextArea.wrapStyleWord = true - jTextArea.autoscrolls = true + val jTextArea = JTextArea(15, 50) + jTextArea.minimumSize = JBDimension(750, 400) +// jTextArea.lineWrap = true +// jTextArea.wrapStyleWord = true +// jTextArea.autoscrolls = true return jTextArea } @@ -141,6 +143,9 @@ class JsonInputDialog(private val classsName: String, project: Project) : Messag protected fun createMyScrollableTextComponent(): JComponent { val jbScrollPane = JBScrollPane(myField) jbScrollPane.preferredSize = JBDimension(700, 350) + jbScrollPane.autoscrolls = true + jbScrollPane.horizontalScrollBarPolicy = JBScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED + jbScrollPane.verticalScrollBarPolicy = JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED return jbScrollPane } @@ -170,6 +175,12 @@ class JsonInputDialog(private val classsName: String, project: Project) : Messag } } + feedBackFormatJSONActionInfo() + + } + + private fun feedBackFormatJSONActionInfo() { + Thread { sendActionInfo(prettyGson.toJson(FormatJSONAction())) }.start() } }