nashorn: frames view — correct presentation of stack frame (function name is not yet displayed)

This commit is contained in:
Vladimir Krivosheev
2014-03-05 15:33:26 +01:00
parent 35fd0fc6dc
commit ad2e3a9f07
4 changed files with 59 additions and 3 deletions
@@ -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<PositionManager> myPositionManagers = new ArrayList<PositionManager>();
@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;
}
}
@@ -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 "";
}
@@ -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);
}
@@ -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();