mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
nashorn: x variables view
This commit is contained in:
@@ -17,9 +17,9 @@ 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.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.sun.jdi.Location;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
@@ -100,10 +100,10 @@ public class CompoundPositionManager extends PositionManagerEx {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XStackFrame createStackFrame(@NotNull Location location) {
|
||||
public XStackFrame createStackFrame(@NotNull StackFrameDescriptorImpl frameDescriptor) {
|
||||
for (PositionManager positionManager : myPositionManagers) {
|
||||
if (positionManager instanceof PositionManagerEx) {
|
||||
XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(location);
|
||||
XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(frameDescriptor);
|
||||
if (xStackFrame != null) {
|
||||
return xStackFrame;
|
||||
}
|
||||
|
||||
+4
-3
@@ -13,14 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger;
|
||||
package com.intellij.debugger.engine;
|
||||
|
||||
import com.intellij.debugger.PositionManager;
|
||||
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
|
||||
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);
|
||||
public abstract XStackFrame createStackFrame(@NotNull StackFrameDescriptorImpl frameDescriptor);
|
||||
}
|
||||
@@ -52,9 +52,12 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.ui.tree.TreeModelAdapter;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.sun.jdi.*;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import gnu.trove.TObjectProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.event.TreeModelEvent;
|
||||
import javax.swing.tree.TreeModel;
|
||||
@@ -67,9 +70,17 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
private boolean myAnyNewLocals;
|
||||
private boolean myAutoWatchMode = false;
|
||||
|
||||
public FrameVariablesTree(Project project) {
|
||||
private final VariablesPanel myVariablesPanel;
|
||||
|
||||
public FrameVariablesTree(@NotNull Project project) {
|
||||
this(project, null);
|
||||
}
|
||||
|
||||
public FrameVariablesTree(@NotNull Project project, @Nullable VariablesPanel variablesPanel) {
|
||||
super(project);
|
||||
|
||||
getEmptyText().setText(XDebuggerBundle.message("debugger.variables.not.available"));
|
||||
myVariablesPanel = variablesPanel;
|
||||
}
|
||||
|
||||
public boolean isAutoWatchMode() {
|
||||
@@ -122,7 +133,21 @@ public class FrameVariablesTree extends DebuggerTree {
|
||||
public BuildFrameTreeVariablesCommand(DebuggerTreeNodeImpl stackNode) {
|
||||
super(stackNode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void threadAction() {
|
||||
if (myVariablesPanel != null) {
|
||||
StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor();
|
||||
XStackFrame xStackFrame = stackDescriptor.getXStackFrame();
|
||||
myVariablesPanel.stackChanged(xStackFrame);
|
||||
if (xStackFrame != null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.threadAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildVariables(final StackFrameDescriptorImpl stackDescriptor, final EvaluationContextImpl evaluationContext) throws EvaluateException {
|
||||
final DebuggerContextImpl debuggerContext = getDebuggerContext();
|
||||
|
||||
@@ -23,9 +23,19 @@ import com.intellij.debugger.impl.DebuggerStateManager;
|
||||
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.evaluation.EvaluationMode;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.impl.frame.XVariablesViewBase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -34,14 +44,25 @@ import java.awt.event.KeyEvent;
|
||||
public class VariablesPanel extends DebuggerTreePanel implements DataProvider {
|
||||
@NonNls private static final String HELP_ID = "debugging.debugFrame";
|
||||
|
||||
private static final String TREE = "tree";
|
||||
private static final String X_TREE = "xTree";
|
||||
private final JPanel myCards;
|
||||
private final MyXVariablesView myXTree;
|
||||
|
||||
public VariablesPanel(Project project, DebuggerStateManager stateManager, Disposable parent) {
|
||||
super(project, stateManager);
|
||||
setBorder(null);
|
||||
|
||||
setBorder(null);
|
||||
|
||||
final FrameVariablesTree frameTree = getFrameTree();
|
||||
|
||||
add(ScrollPaneFactory.createScrollPane(frameTree), BorderLayout.CENTER);
|
||||
myCards = new JPanel(new CardLayout());
|
||||
myCards.add(frameTree, TREE);
|
||||
|
||||
myXTree = new MyXVariablesView(project);
|
||||
myCards.add(myXTree.getTree(), X_TREE);
|
||||
|
||||
add(ScrollPaneFactory.createScrollPane(myCards), BorderLayout.CENTER);
|
||||
registerDisposable(DebuggerAction.installEditAction(frameTree, DebuggerActions.EDIT_NODE_SOURCE));
|
||||
|
||||
overrideShortcut(frameTree, DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
|
||||
@@ -52,7 +73,7 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider {
|
||||
|
||||
@Override
|
||||
protected DebuggerTree createTreeView() {
|
||||
return new FrameVariablesTree(getProject());
|
||||
return new FrameVariablesTree(getProject(), SystemProperties.getBooleanProperty("java.debugger.xTree", false) ? this : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,8 +97,46 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider {
|
||||
return super.getData(dataId);
|
||||
}
|
||||
|
||||
|
||||
public FrameVariablesTree getFrameTree() {
|
||||
return (FrameVariablesTree)getTree();
|
||||
}
|
||||
|
||||
public void stackChanged(@Nullable XStackFrame xStackFrame) {
|
||||
myXTree.stackChanged(xStackFrame);
|
||||
((CardLayout)(myCards.getLayout())).show(myCards, xStackFrame == null ? TREE : X_TREE);
|
||||
}
|
||||
|
||||
private static final class MyXVariablesView extends XVariablesViewBase {
|
||||
private XStackFrame myCurrentXStackFrame;
|
||||
|
||||
public MyXVariablesView(Project project) {
|
||||
super(project, new XDebuggerEditorsProvider() {
|
||||
@NotNull
|
||||
@Override
|
||||
public FileType getFileType() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode mode) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
public void stackChanged(@Nullable XStackFrame stackFrame) {
|
||||
if (myCurrentXStackFrame != null) {
|
||||
saveCurrentTreeState(stackFrame);
|
||||
}
|
||||
|
||||
myCurrentXStackFrame = stackFrame;
|
||||
if (stackFrame == null) {
|
||||
getTree().setSourcePosition(null);
|
||||
}
|
||||
else {
|
||||
buildTreeAndRestoreState(stackFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void threadAction() {
|
||||
public void threadAction() {
|
||||
try {
|
||||
final StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor();
|
||||
final StackFrameProxyImpl frame = stackDescriptor.getFrameProxy();
|
||||
|
||||
+7
-5
@@ -16,10 +16,7 @@
|
||||
package com.intellij.debugger.ui.impl.watch;
|
||||
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.engine.ContextUtil;
|
||||
import com.intellij.debugger.engine.DebugProcess;
|
||||
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
@@ -102,7 +99,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac
|
||||
myIsInLibraryContent = false;
|
||||
}
|
||||
|
||||
myXStackFrame = myLocation == null ? null : getDebugProcess().getPositionManager().createStackFrame(myLocation);
|
||||
myXStackFrame = myLocation == null ? null : ((DebugProcessImpl)getDebugProcess()).getPositionManager().createStackFrame(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public XStackFrame getXStackFrame() {
|
||||
return myXStackFrame;
|
||||
}
|
||||
|
||||
public int getUiIndex() {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
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;
|
||||
@@ -45,7 +44,7 @@ public interface DebugProcess {
|
||||
|
||||
RequestManager getRequestsManager();
|
||||
|
||||
PositionManagerEx getPositionManager();
|
||||
PositionManager getPositionManager();
|
||||
|
||||
VirtualMachineProxy getVirtualMachineProxy();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user