mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(editor): don't show popups if editor is not attached to window (#1752)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package com.itsaky.androidide.editor.ui
|
||||
|
||||
import com.itsaky.androidide.utils.ILogger
|
||||
import io.github.rosemoe.sora.widget.CodeEditor
|
||||
import io.github.rosemoe.sora.widget.base.EditorPopupWindow
|
||||
|
||||
@@ -28,8 +29,17 @@ import io.github.rosemoe.sora.widget.base.EditorPopupWindow
|
||||
abstract class AbstractPopupWindow(editor: CodeEditor, features: Int) :
|
||||
EditorPopupWindow(editor, features) {
|
||||
|
||||
companion object {
|
||||
private val log = ILogger.newInstance("AbstractPopupWindow")
|
||||
}
|
||||
|
||||
override fun show() {
|
||||
(editor as? IDEEditor)?.ensureWindowsDismissed()
|
||||
if (!editor.isAttachedToWindow) {
|
||||
log.error("Trying to show popup window '${javaClass.name}' when editor is not attached to window")
|
||||
return
|
||||
}
|
||||
|
||||
super.show()
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ import kotlin.math.min
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
@SuppressLint("RestrictedApi")
|
||||
open class EditorActionsMenu constructor(val editor: IDEEditor) :
|
||||
open class EditorActionsMenu(val editor: IDEEditor) :
|
||||
AbstractPopupWindow(editor, FEATURE_SHOW_OUTSIDE_VIEW_ALLOWED),
|
||||
ActionsRegistry.ActionExecListener,
|
||||
MenuBuilder.Callback {
|
||||
|
||||
Reference in New Issue
Block a user