mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't collapse node with null value after edit
This commit is contained in:
+3
-5
@@ -62,13 +62,11 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti
|
||||
private void restoreNode(final XDebuggerTreeNode treeNode, final XDebuggerTreeState.NodeInfo parentInfo) {
|
||||
if (treeNode instanceof XValueNodeImpl) {
|
||||
XValueNodeImpl node = (XValueNodeImpl)treeNode;
|
||||
String nodeName = node.getName();
|
||||
String nodeValue = node.getValue();
|
||||
if (nodeName == null || nodeValue == null) {
|
||||
myNode2ParentState.put(node, parentInfo);
|
||||
if (node.isComputed()) {
|
||||
doRestoreNode(node, parentInfo, node.getName(), node.getValue());
|
||||
}
|
||||
else {
|
||||
doRestoreNode(node, parentInfo, nodeName, nodeValue);
|
||||
myNode2ParentState.put(node, parentInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -18,12 +18,12 @@ package com.intellij.xdebugger.impl.ui.tree;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -80,10 +80,8 @@ public class XDebuggerTreeState {
|
||||
private static NodeInfo createNode(final XDebuggerTreeNode node, boolean selected) {
|
||||
if (node instanceof XValueNodeImpl) {
|
||||
XValueNodeImpl valueNode = (XValueNodeImpl)node;
|
||||
String name = valueNode.getName();
|
||||
String value = valueNode.getValue();
|
||||
if (name != null && value != null) {
|
||||
return new NodeInfo(name, value, selected);
|
||||
if (valueNode.isComputed()) {
|
||||
return new NodeInfo(valueNode.getName(), valueNode.getValue(), selected);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -94,7 +92,7 @@ public class XDebuggerTreeState {
|
||||
private final String myValue;
|
||||
private boolean myExpanded;
|
||||
private final boolean mySelected;
|
||||
private Map<String, NodeInfo> myChidlren;
|
||||
private Map<String, NodeInfo> myChildren;
|
||||
|
||||
public NodeInfo(final String name, final String value, boolean selected) {
|
||||
myName = name;
|
||||
@@ -103,10 +101,10 @@ public class XDebuggerTreeState {
|
||||
}
|
||||
|
||||
public void addChild(@NotNull NodeInfo child) {
|
||||
if (myChidlren == null) {
|
||||
myChidlren = new HashMap<String, NodeInfo>();
|
||||
if (myChildren == null) {
|
||||
myChildren = new THashMap<String, NodeInfo>();
|
||||
}
|
||||
myChidlren.put(child.myName, child);
|
||||
myChildren.put(child.myName, child);
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
@@ -123,7 +121,7 @@ public class XDebuggerTreeState {
|
||||
|
||||
@Nullable
|
||||
public NodeInfo removeChild(@NotNull String name) {
|
||||
return myChidlren != null ? myChidlren.remove(name) : null;
|
||||
return myChildren != null ? myChildren.remove(name) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -52,8 +52,7 @@ public abstract class XFetchValueActionBase extends AnAction {
|
||||
for (TreePath path : paths) {
|
||||
Object node = path.getLastPathComponent();
|
||||
if (node instanceof XValueNodeImpl) {
|
||||
XValueNodeImpl valueNode = (XValueNodeImpl)node;
|
||||
if (valueNode.getName() != null && valueNode.getValue() != null) {
|
||||
if (((XValueNodeImpl)node).isComputed()) {
|
||||
e.getPresentation().setEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
+9
@@ -235,6 +235,10 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
|
||||
return myValue;
|
||||
}
|
||||
|
||||
public boolean isComputed() {
|
||||
return myName != null && myValuePresenter != null;
|
||||
}
|
||||
|
||||
public void setValueModificationStarted() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
myValue = null;
|
||||
@@ -245,4 +249,9 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
|
||||
setLeaf(true);
|
||||
fireNodeStructureChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user