From bf22b9390cf1bdddcaefa4a277cfcff9ec80238d Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 9 Feb 2016 19:00:39 +0300 Subject: [PATCH] editor notification for source code matcher --- .../debugger/impl/SourceCodeChecker.java | 18 ++++++++++++++++-- .../src/messages/DebuggerBundle.properties | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java b/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java index 2e6ae975ebcf..0d90e308075e 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/SourceCodeChecker.java @@ -15,6 +15,8 @@ */ package com.intellij.debugger.impl; +import com.intellij.codeInsight.hint.HintManager; +import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.SourcePosition; import com.intellij.debugger.engine.CompoundPositionManager; import com.intellij.debugger.engine.DebugProcessImpl; @@ -29,6 +31,9 @@ import com.intellij.notification.NotificationType; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileEditor.FileEditorManager; +import com.intellij.openapi.fileEditor.TextEditor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.TextRange; @@ -37,6 +42,7 @@ import com.intellij.psi.PsiCompiledFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; +import com.intellij.ui.AppUIUtil; import com.intellij.util.ThreeState; import com.intellij.util.containers.ContainerUtil; import com.intellij.xdebugger.impl.XDebugSessionImpl; @@ -133,8 +139,16 @@ public class SourceCodeChecker { LOG.debug("Source check failed: method " + method.name() + " not found in sources"); } if (!res) { - XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Source code does not match the bytecode", NotificationType.WARNING) - .notify(project); + FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(position.getFile().getVirtualFile()); + if (editor instanceof TextEditor) { + AppUIUtil.invokeOnEdt(() -> HintManager.getInstance().showErrorHint(((TextEditor)editor).getEditor(), + DebuggerBundle.message("warning.source.code.not.match"))); + } + else { + XDebugSessionImpl.NOTIFICATION_GROUP + .createNotification(DebuggerBundle.message("warning.source.code.not.match"), NotificationType.WARNING) + .notify(project); + } return ThreeState.NO; } return ThreeState.YES; diff --git a/resources-en/src/messages/DebuggerBundle.properties b/resources-en/src/messages/DebuggerBundle.properties index 9181929a795c..57dd473518ba 100644 --- a/resources-en/src/messages/DebuggerBundle.properties +++ b/resources-en/src/messages/DebuggerBundle.properties @@ -40,6 +40,7 @@ action.resume.thread.text.unfreeze=Unfreeze action.interrupt.thread.text=Interrupt title.set.value=Set Value warning.recalculate=The value will be recalculated +warning.source.code.not.match=Source code does not match the bytecode progress.set.value=Setting value... action.add.field.watchpoint.text=Add Field Watchpoint status.process.started=Process started