show mark for a stack frame executing a method from marked object

This commit is contained in:
Egor.Ushakov
2014-05-30 15:43:14 +04:00
parent c4dc5439e0
commit 89dc105b5b
3 changed files with 16 additions and 5 deletions
@@ -29,6 +29,7 @@ import com.intellij.util.StringBuilderSpinAllocator;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.sun.jdi.ObjectCollectedException;
import com.sun.jdi.ObjectReference;
@@ -77,7 +78,8 @@ public class CodeFragmentFactoryContextWrapper extends CodeFragmentFactory {
PsiElement context = originalContext;
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session != null) {
Map<?, ValueMarkup> markupMap = ((XDebugSessionImpl)session).getValueMarkers().getAllMarkers();
XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
Map<?, ValueMarkup> markupMap = markers != null ? markers.getAllMarkers() : null;
//final Map<ObjectReference, ValueMarkup> markupMap = ValueDescriptorImpl.getMarkupMap(process);
if (markupMap != null && markupMap.size() > 0) {
final Pair<String, Map<String, ObjectReference>> markupVariables = createMarkupVariablesText(markupMap);
@@ -32,7 +32,10 @@ import com.intellij.psi.PsiFile;
import com.intellij.ui.FileColorManager;
import com.intellij.util.StringBuilderSpinAllocator;
import com.intellij.util.ui.TextTransferable;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.sun.jdi.*;
import org.jetbrains.annotations.NotNull;
@@ -40,7 +43,6 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.Map;
/**
* Nodes of this type cannot be updated, because StackFrame objects become invalid as soon as VM has been resumed
@@ -146,9 +148,15 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
@Nullable
public ValueMarkup getValueMarkup() {
if (myThisObject != null) {
final Map<ObjectReference, ValueMarkup> markupMap = getMarkupMap(myFrame.getVirtualMachine().getDebugProcess());
if (markupMap != null) {
return markupMap.get(myThisObject);
DebugProcess process = myFrame.getVirtualMachine().getDebugProcess();
if (process instanceof DebugProcessImpl) {
XDebugSession session = ((DebugProcessImpl)process).getSession().getXDebugSession();
if (session instanceof XDebugSessionImpl) {
XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
if (markers != null) {
return markers.getAllMarkers().get(myThisObject);
}
}
}
}
return null;
@@ -345,6 +345,7 @@ public class XDebugSessionImpl implements XDebugSession {
.showRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
}
@Nullable
public synchronized XValueMarkers<?, ?> getValueMarkers() {
if (myValueMarkers == null) {
XValueMarkerProvider<?, ?> provider = myDebugProcess.createValueMarkerProvider();