add "Collecting" message only if computation is not yet done

This commit is contained in:
Vladimir Krivosheev
2013-08-30 14:39:56 +02:00
parent cafb4a9566
commit 6ec1856ccb
3 changed files with 24 additions and 14 deletions
@@ -51,4 +51,4 @@ public class XValueHintTreeComponent extends AbstractValueHintTreeComponent<Pair
updateTree(item);
}
}
}
}
@@ -35,13 +35,14 @@ import javax.swing.*;
public class XInspectDialog extends DialogWrapper {
private final XDebuggerTreePanel myTreePanel;
public XInspectDialog(final XDebugSession session, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition, @NotNull String nodeName, @NotNull XValue value) {
public XInspectDialog(XDebugSession session, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition, @NotNull String name, @NotNull XValue value) {
super(session.getProject(), false);
setTitle(XDebuggerBundle.message("inspect.value.dialog.title", nodeName));
setTitle(XDebuggerBundle.message("inspect.value.dialog.title", name));
setModal(false);
myTreePanel = new XDebuggerTreePanel(session, editorsProvider, myDisposable, sourcePosition, XDebuggerActions.INSPECT_TREE_POPUP_GROUP);
XDebuggerTree tree = myTreePanel.getTree();
tree.setRoot(new XValueNodeImpl(tree, null, nodeName, value), true);
tree.setRoot(new XValueNodeImpl(tree, null, name, value), true);
init();
}
@@ -62,4 +63,4 @@ public class XInspectDialog extends DialogWrapper {
protected String getDimensionServiceKey() {
return "#xdebugger.XInspectDialog";
}
}
}
@@ -57,15 +57,21 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
private boolean myChanged;
private XValuePresenter myValuePresenter;
public XValueNodeImpl(XDebuggerTree tree, final XDebuggerTreeNode parent, String name, final @NotNull XValue value) {
public XValueNodeImpl(XDebuggerTree tree, XDebuggerTreeNode parent, String name, @NotNull XValue value) {
super(tree, parent, value);
myName = name;
if (myName != null) {
myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
myText.append(XDebuggerUIConstants.EQ_TEXT, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
myText.append(XDebuggerUIConstants.COLLECTING_DATA_MESSAGE, XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
value.computePresentation(this, XValuePlace.TREE);
// add "Collecting" message only if computation is not yet done
if (!isComputed()) {
if (myName != null) {
myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
myText.append(XDebuggerUIConstants.EQ_TEXT, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
myText.append(XDebuggerUIConstants.COLLECTING_DATA_MESSAGE, XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
}
}
@Override
@@ -171,13 +177,16 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
myText.append("[" + markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor()));
}
}
appendName();
buildText(myType, myValue, myValuePresenter, myText, myChanged);
}
private void appendName() {
if (!StringUtil.isEmpty(myName)) {
StringValuePresenter.append(myName, myText,
ObjectUtils.notNull(myValuePresenter.getNameAttributes(), XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES),
MAX_VALUE_LENGTH, null);
}
buildText(myType, myValue, myValuePresenter, myText, myChanged);
}
public static void buildText(@Nullable String type,
@@ -254,7 +263,7 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
ApplicationManager.getApplication().assertIsDispatchThread();
myValue = null;
myText.clear();
myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
appendName();
myValuePresenter.appendSeparator(myText);
myText.append(XDebuggerUIConstants.MODIFYING_VALUE_MESSAGE, XDebuggerUIConstants.MODIFYING_VALUE_HIGHLIGHT_ATTRIBUTES);
setLeaf(true);