File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
src/main/java/com/tang/intellij/lua/luacheck Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,20 @@ import com.intellij.openapi.actionSystem.AnAction
2020import com.intellij.openapi.actionSystem.AnActionEvent
2121import com.intellij.openapi.actionSystem.CommonDataKeys
2222import com.intellij.openapi.actionSystem.DataKeys
23+ import com.intellij.openapi.options.ShowSettingsUtil
2324import com.tang.intellij.lua.lang.LuaFileType
2425
2526class LuaCheckGroup : AnAction () {
2627 override fun actionPerformed (event : AnActionEvent ) {
2728 val project = event.getData(DataKeys .PROJECT )!!
2829 val file = event.getData(CommonDataKeys .VIRTUAL_FILE )
2930 if (file != null ) {
30- runLuaCheck(project, file)
31+ val settings = LuaCheckSettings .getInstance()
32+ if (settings.valid) {
33+ runLuaCheck(project, file)
34+ } else {
35+ ShowSettingsUtil .getInstance().showSettingsDialog(project, LuaCheckSettingsPanel ::class .java)
36+ }
3137 }
3238 }
3339
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import com.intellij.openapi.components.PersistentStateComponent
2020import com.intellij.openapi.components.ServiceManager
2121import com.intellij.openapi.components.State
2222import com.intellij.openapi.components.Storage
23+ import com.intellij.openapi.util.text.StringUtil
2324import com.intellij.util.xmlb.XmlSerializerUtil
2425
2526@State(name = " LuaCheckSettings" , storages = arrayOf(Storage (" emmy.xml" )))
@@ -32,6 +33,14 @@ class LuaCheckSettings : PersistentStateComponent<LuaCheckSettings> {
3233 override fun loadState (settings : LuaCheckSettings ) {
3334 XmlSerializerUtil .copyBean(settings, this )
3435 }
36+
37+ val valid: Boolean get() {
38+ if (StringUtil .isEmpty(luaCheck))
39+ return false
40+
41+ return true
42+ }
43+
3544 companion object {
3645 @JvmStatic fun getInstance (): LuaCheckSettings {
3746 return ServiceManager .getService(LuaCheckSettings ::class .java)
You can’t perform that action at this time.
0 commit comments