diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.form b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.form
index 2a6cb130..f1b80b2e 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.form
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.form
@@ -1,278 +1,294 @@
-
\ No newline at end of file
diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.kt b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.kt
index b65a7a51..54770c72 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.kt
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ApiCallDialog.kt
@@ -189,35 +189,8 @@ class ApiCallDialog : ContextDialog(), ApiCallUI {
initApisModule()
LOG.info("init RequestModule")
initRequestModule()
- resize()
- this.onResized {
- resize()
- }
- this.requestPanel.onResized {
- resize()
- }
- this.responsePanel.onResized {
- resize()
- }
}
- private val resize = {
- actionContext.runInSwingUI {
- val rightWidth = this.contentPane.width - this.apisListPanel.width
-
- val rightPanel = this.rightPanel
- rightPanel.setSizeIfNecessary(rightWidth, this.contentPane.height - 6)
-
- val requestPanel = this.requestPanel
- requestPanel.setSizeIfNecessary(rightWidth - 30, requestPanel.height)
-
- this.responsePanel.let {
- it.setSizeIfNecessary(rightWidth - 30, it.height)
- it.bottomAlignTo(this.apisJList)
- }
- }
- }.throttle(50, TimeUnit.MILLISECONDS)
-
//region api module
private fun initApisModule() {
@@ -268,7 +241,6 @@ class ApiCallDialog : ContextDialog(), ApiCallUI {
?.response?.firstOrNull()?.body?.let { RequestUtils.parseRawBody(it) }
?: ""
formatForm(currRequest)
- resize()
}
override fun updateRequestList(requestList: List?) {
@@ -293,7 +265,6 @@ class ApiCallDialog : ContextDialog(), ApiCallUI {
if (requestRawViewList.isNotEmpty()) {
this.apisJList.selectedIndex = 0
}
- resize()
}
}
diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ContextDialog.kt b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ContextDialog.kt
index 078e37b3..e77b74e4 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ContextDialog.kt
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/ContextDialog.kt
@@ -1,6 +1,8 @@
package com.itangcent.idea.plugin.dialog
import com.google.inject.Inject
+import com.intellij.ide.util.PropertiesComponent
+import com.itangcent.common.logger.Log
import com.itangcent.common.logger.traceError
import com.itangcent.common.utils.safe
import com.itangcent.idea.utils.initAfterShown
@@ -8,12 +10,19 @@ import com.itangcent.intellij.constant.EventKey
import com.itangcent.intellij.context.ActionContext
import com.itangcent.intellij.extend.guice.PostConstruct
import com.itangcent.intellij.logger.Logger
+import java.awt.Dimension
import java.awt.event.WindowAdapter
import java.awt.event.WindowEvent
import javax.swing.JDialog
import javax.swing.WindowConstants
abstract class ContextDialog : JDialog() {
+ companion object : Log() {
+ private const val LAST_SIZE = "com.itangcent.easyapi.suv.last.size"
+ }
+
+ private val lastSizePropertiesName
+ get() = "$LAST_SIZE.${this::class.qualifiedName}"
@Inject
protected lateinit var actionContext: ActionContext
@@ -36,6 +45,8 @@ abstract class ContextDialog : JDialog() {
}
})
+ restoreSize()
+
this.initAfterShown {
try {
init()
@@ -45,6 +56,22 @@ abstract class ContextDialog : JDialog() {
} finally {
init = true
}
+
+ //restore size
+ restoreSize()
+ }
+ }
+
+ private fun restoreSize() {
+ PropertiesComponent.getInstance().getValue(lastSizePropertiesName)?.let {
+ val split = it.split(",")
+ if (split.size == 2) {
+ val width = split[0].toIntOrNull()
+ val height = split[1].toIntOrNull()
+ if (width != null && height != null) {
+ this.size = Dimension(width, height)
+ }
+ }
}
}
@@ -87,12 +114,22 @@ abstract class ContextDialog : JDialog() {
if (!disposed) {
disposed = true
dispose()
- safe { onDispose() }
+ actionContext.runAsync {
+ safe {
+ PropertiesComponent.getInstance().setValue(
+ lastSizePropertiesName,
+ "${this.size.width},${this.size.height}"
+ )
+ }
+ safe { onDispose() }
+ safe {
+ actionContext.unHold()
+ actionContext.stop()
+ }
+ }
}
}
open fun onDispose() {
- actionContext.unHold()
- actionContext.stop()
}
}
\ No newline at end of file
diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingGUI.form b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingGUI.form
index 911fb80e..5b46fe4c 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingGUI.form
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingGUI.form
@@ -3,118 +3,72 @@
-
+
-
+
-
+
-
+
-
+
+
+
-
+
-
+
-
-
-
+
-
+
-
+
-
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -126,513 +80,335 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
+
+
+
+
+
-
-
+
-
-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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRecommendGUI.form b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRecommendGUI.form
index 2ca8b663..540569bc 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRecommendGUI.form
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRecommendGUI.form
@@ -12,7 +12,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRemoteConfigGUI.form b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRemoteConfigGUI.form
index 6d2ebbcb..8f548de5 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRemoteConfigGUI.form
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/EasyApiSettingRemoteConfigGUI.form
@@ -8,25 +8,31 @@
-
+
-
+
-
+
+
+
+
+
+
+
-
+
-
+
@@ -38,7 +44,7 @@
-
+
@@ -50,7 +56,7 @@
-
+
@@ -64,7 +70,7 @@
-
+
@@ -74,7 +80,7 @@
-
+
@@ -87,23 +93,35 @@
-
+
+
-
+
+
+
-
-
-
+
-
-
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/SuvApiExportDialog.form b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/SuvApiExportDialog.form
index f2ba735a..62ff9115 100644
--- a/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/SuvApiExportDialog.form
+++ b/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/dialog/SuvApiExportDialog.form
@@ -1,132 +1,120 @@