mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-332451 Fix showing inlay toolbar after inlay Run-To-Cursor action was clicked
GitOrigin-RevId: 752e8ca5b951a4656690946f1cd10eaef5df2f93
This commit is contained in:
committed by
intellij-monorepo-bot
parent
830fa2b1c9
commit
d8fea3d5d5
+8
-3
@@ -100,7 +100,7 @@ class InlayRunToCursorEditorListener(private val project: Project, private val c
|
||||
return true
|
||||
}
|
||||
|
||||
if (editor.getEditorKind() != EditorKind.MAIN_EDITOR) {
|
||||
if (editor.getEditorKind() != EditorKind.MAIN_EDITOR && e != null) {
|
||||
return true
|
||||
}
|
||||
val session = XDebuggerManager.getInstance(project).getCurrentSession() as XDebugSessionImpl?
|
||||
@@ -109,7 +109,7 @@ class InlayRunToCursorEditorListener(private val project: Project, private val c
|
||||
return true
|
||||
}
|
||||
IntentionsUIImpl.DISABLE_INTENTION_BULB[project] = true
|
||||
val lineNumber = if (e != null) XDebuggerManagerImpl.getLineNumber(e) else lineFromCurrentMouse(editor)
|
||||
val lineNumber = if (e != null) XDebuggerManagerImpl.getLineNumber(e) else lineFromCurrentMouse(editor) ?: return false
|
||||
if (lineNumber < 0) {
|
||||
return true
|
||||
}
|
||||
@@ -122,10 +122,15 @@ class InlayRunToCursorEditorListener(private val project: Project, private val c
|
||||
return true
|
||||
}
|
||||
|
||||
private fun lineFromCurrentMouse(editor: Editor): Int {
|
||||
private fun lineFromCurrentMouse(editor: Editor): Int? {
|
||||
val location = MouseInfo.getPointerInfo().location
|
||||
SwingUtilities.convertPointFromScreen(location, editor.getContentComponent())
|
||||
|
||||
val editorGutterComponentEx = editor.gutter as? EditorGutterComponentEx ?: return null
|
||||
if (!editor.getContentComponent().bounds.contains(location) && !editorGutterComponentEx.bounds.contains(location)) {
|
||||
return null
|
||||
}
|
||||
|
||||
val logicalPosition: LogicalPosition = editor.xyToLogicalPosition(location)
|
||||
if (logicalPosition.line >= editor.document.getLineCount()) {
|
||||
return -1
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManagerListener;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -47,10 +48,7 @@ import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.DocumentUtil;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.XDebugProcess;
|
||||
import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.*;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
|
||||
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
|
||||
@@ -294,6 +292,21 @@ public final class XDebuggerManagerImpl extends XDebuggerManager implements Pers
|
||||
|
||||
session.init(process, contentToReuse);
|
||||
|
||||
if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
|
||||
session.addSessionListener(new XDebugSessionListener() {
|
||||
@Override
|
||||
public void sessionPaused() {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
|
||||
if (editor == null) {
|
||||
return;
|
||||
}
|
||||
myNewRunToCursorListener.reshowInlayRunToCursor(editor);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mySessions.put(session.getDebugProcess().getProcessHandler(), session);
|
||||
|
||||
return session;
|
||||
|
||||
Reference in New Issue
Block a user