editor notification for source code matcher

This commit is contained in:
Egor.Ushakov
2016-02-09 19:01:15 +03:00
parent 52d38ff391
commit bf22b9390c
2 changed files with 17 additions and 2 deletions
@@ -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;
@@ -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