Skip to content

Commit

Permalink
Release 1.6.2
Browse files Browse the repository at this point in the history
Add feedback about format json action
  • Loading branch information
sealkingking committed Feb 23, 2018
1 parent 91c3fd9 commit 48c5898
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>wu.seal.tool.jsontokotlin</id>
<name>JsonToKotlinClass</name>
<version>1.6.2-beta</version>
<version>1.6.2</version>
<vendor email="[email protected]" url="https://www.github.com/wuseal">Seal</vendor>

<description><![CDATA[
Expand Down Expand Up @@ -32,7 +32,7 @@
</extensions>

<actions>
<action id="wu.seal.wu.seal.jsontokotlin.makekotlindata" class="wu.seal.jsontokotlin.MakeKotlinClassAction" text="Convert Json Into Kotlin Class" description="convert a json string data into kotlin data class" >
<action id="wu.seal.wu.seal.jsontokotlin.makekotlindata" class="wu.seal.jsontokotlin.MakeKotlinClassAction" text="Convert Json Into Kotlin Class" description="convert a json string data into kotlin data class code" >
<add-to-group group-id="GenerateGroup" anchor="last"/>
<keyboard-shortcut keymap="$default" first-keystroke="alt k"/>
</action>
Expand Down
2 changes: 1 addition & 1 deletion src/wu/seal/jsontokotlin/JsonToKotlinApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
9 changes: 9 additions & 0 deletions src/wu/seal/jsontokotlin/feedback/Actions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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())
)
27 changes: 19 additions & 8 deletions src/wu/seal/jsontokotlin/ui/JsonInputDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -129,18 +131,21 @@ 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
}


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
}

Expand Down Expand Up @@ -170,6 +175,12 @@ class JsonInputDialog(private val classsName: String, project: Project) : Messag
}
}

feedBackFormatJSONActionInfo()

}

private fun feedBackFormatJSONActionInfo() {
Thread { sendActionInfo(prettyGson.toJson(FormatJSONAction())) }.start()
}
}

Expand Down

0 comments on commit 48c5898

Please sign in to comment.