diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java index 5df46743633c..399c55fd00e5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java @@ -17,18 +17,21 @@ package com.intellij.debugger.engine; import com.intellij.debugger.NoDataException; import com.intellij.debugger.PositionManager; +import com.intellij.debugger.PositionManagerEx; import com.intellij.debugger.SourcePosition; import com.intellij.debugger.requests.ClassPrepareRequestor; +import com.intellij.xdebugger.frame.XStackFrame; import com.sun.jdi.Location; import com.sun.jdi.ReferenceType; import com.sun.jdi.request.ClassPrepareRequest; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class CompoundPositionManager implements PositionManager { +public class CompoundPositionManager extends PositionManagerEx { private final ArrayList myPositionManagers = new ArrayList(); @SuppressWarnings("UnusedDeclaration") @@ -94,4 +97,18 @@ public class CompoundPositionManager implements PositionManager { return null; } + + @Nullable + @Override + public XStackFrame createStackFrame(@NotNull Location location) { + for (PositionManager positionManager : myPositionManagers) { + if (positionManager instanceof PositionManagerEx) { + XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(location); + if (xStackFrame != null) { + return xStackFrame; + } + } + } + return null; + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java index 71a5e4d6d916..8e11e545dcd0 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java @@ -34,6 +34,8 @@ import com.intellij.openapi.vfs.VirtualFile; 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.frame.XStackFrame; import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; import com.sun.jdi.*; import org.jetbrains.annotations.Nullable; @@ -50,6 +52,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac private int myUiIndex; private String myName = null; private Location myLocation; + private final XStackFrame myXStackFrame; private MethodsTracker.MethodOccurrence myMethodOccurrence; private boolean myIsSynthetic; private boolean myIsInLibraryContent; @@ -84,7 +87,7 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac } }); } - catch(InternalException e) { + catch (InternalException e) { LOG.info(e); myLocation = null; myMethodOccurrence = tracker.getMethodOccurrence(null); @@ -98,6 +101,8 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac myIsSynthetic = false; myIsInLibraryContent = false; } + + myXStackFrame = myLocation == null ? null : getDebugProcess().getPositionManager().createStackFrame(myLocation); } public int getUiIndex() { @@ -151,6 +156,13 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac @Override protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener descriptorLabelListener) throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); + + if (myXStackFrame != null) { + TextTransferable.ColoredStringBuilder builder = new TextTransferable.ColoredStringBuilder(); + myXStackFrame.customizePresentation(builder); + return builder.getBuilder().toString(); + } + if (myLocation == null) { return ""; } diff --git a/java/debugger/openapi/src/com/intellij/debugger/PositionManagerEx.java b/java/debugger/openapi/src/com/intellij/debugger/PositionManagerEx.java new file mode 100644 index 000000000000..c1faee1f763f --- /dev/null +++ b/java/debugger/openapi/src/com/intellij/debugger/PositionManagerEx.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.debugger; + +import com.intellij.xdebugger.frame.XStackFrame; +import com.sun.jdi.Location; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public abstract class PositionManagerEx implements PositionManager { + @Nullable + public abstract XStackFrame createStackFrame(@NotNull Location location); +} diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/DebugProcess.java b/java/debugger/openapi/src/com/intellij/debugger/engine/DebugProcess.java index 66fea2d7f38c..43c7fd47f02f 100644 --- a/java/debugger/openapi/src/com/intellij/debugger/engine/DebugProcess.java +++ b/java/debugger/openapi/src/com/intellij/debugger/engine/DebugProcess.java @@ -16,6 +16,7 @@ package com.intellij.debugger.engine; import com.intellij.debugger.PositionManager; +import com.intellij.debugger.PositionManagerEx; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluationContext; import com.intellij.debugger.engine.jdi.VirtualMachineProxy; @@ -44,7 +45,7 @@ public interface DebugProcess { RequestManager getRequestsManager(); - PositionManager getPositionManager(); + PositionManagerEx getPositionManager(); VirtualMachineProxy getVirtualMachineProxy();