use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XFetchValueActionBase method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
List<XValueNodeImpl> nodes = XDebuggerTreeActionBase.getSelectedNodes(e.getDataContext());
if (nodes.isEmpty()) {
return;
}
ValueCollector valueCollector = createCollector(e);
for (XValueNodeImpl node : nodes) {
addToCollector(nodes, node, valueCollector);
}
valueCollector.processed = true;
valueCollector.finish();
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerEditorLinePainter method getLineExtensions.
@Override
public Collection<LineExtensionInfo> getLineExtensions(@NotNull Project project, @NotNull VirtualFile file, int lineNumber) {
if (!XDebuggerSettingsManager.getInstance().getDataViewSettings().isShowValuesInline()) {
return null;
}
XVariablesView.InlineVariablesInfo data = project.getUserData(XVariablesView.DEBUG_VARIABLES);
final Document doc = FileDocumentManager.getInstance().getDocument(file);
if (data == null || doc == null) {
return null;
}
Map<Variable, VariableValue> oldValues = project.getUserData(CACHE);
if (oldValues == null) {
oldValues = new HashMap<>();
project.putUserData(CACHE, oldValues);
}
List<XValueNodeImpl> values = data.get(file, lineNumber, doc.getModificationStamp());
if (values != null && !values.isEmpty()) {
XDebugSession session = XDebugView.getSession(values.iterator().next().getTree());
final int bpLine = getCurrentBreakPointLineInFile(session, file);
boolean isTopFrame = session instanceof XDebugSessionImpl && ((XDebugSessionImpl) session).isTopFrameSelected();
final TextAttributes attributes = bpLine == lineNumber && isTopFrame && ((XDebuggerManagerImpl) XDebuggerManager.getInstance(project)).isFullLineHighlighter() ? getTopFrameSelectedAttributes() : getNormalAttributes();
ArrayList<VariableText> result = new ArrayList<>();
for (XValueNodeImpl value : values) {
SimpleColoredText text = new SimpleColoredText();
XValueTextRendererImpl renderer = new XValueTextRendererImpl(text);
final XValuePresentation presentation = value.getValuePresentation();
if (presentation == null)
continue;
try {
if (presentation instanceof XValueCompactPresentation && !value.getTree().isUnderRemoteDebug()) {
((XValueCompactPresentation) presentation).renderValue(renderer, value);
} else {
presentation.renderValue(renderer);
}
if (StringUtil.isEmpty(text.toString())) {
final String type = value.getValuePresentation().getType();
if (!StringUtil.isEmpty(type)) {
text.append(type, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
} catch (Exception ignored) {
continue;
}
final String name = value.getName();
if (StringUtil.isEmpty(text.toString())) {
continue;
}
final VariableText res = new VariableText();
result.add(res);
res.add(new LineExtensionInfo(" " + name + ": ", attributes));
Variable var = new Variable(name, lineNumber);
VariableValue variableValue = oldValues.computeIfAbsent(var, k -> new VariableValue(text.toString(), null, value.hashCode()));
if (variableValue.valueNodeHashCode != value.hashCode()) {
variableValue.old = variableValue.actual;
variableValue.actual = text.toString();
variableValue.valueNodeHashCode = value.hashCode();
}
if (!variableValue.isChanged()) {
for (String s : text.getTexts()) {
res.add(new LineExtensionInfo(s, attributes));
}
} else {
variableValue.produceChangedParts(res.infos);
}
}
final List<LineExtensionInfo> infos = new ArrayList<>();
for (VariableText text : result) {
infos.addAll(text.infos);
}
return infos.size() > LINE_EXTENSIONS_MAX_COUNT ? infos.subList(0, LINE_EXTENSIONS_MAX_COUNT) : infos;
}
return null;
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerInstanceTreeCreator method createTree.
@NotNull
@Override
public Tree createTree(@NotNull Pair<XInstanceEvaluator, String> descriptor) {
final XDebuggerTree tree = new XDebuggerTree(myProject, myProvider, myPosition, XDebuggerActions.INSPECT_TREE_POPUP_GROUP, myMarkers);
final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(), new InstanceEvaluatorTreeRootValue(descriptor.getFirst(), descriptor.getSecond()));
tree.setRoot(root, false);
Condition<TreeNode> visibleRootCondition = node -> node.getParent() == root;
tree.expandNodesOnLoad(visibleRootCondition);
tree.selectNodeOnLoad(visibleRootCondition);
return tree;
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerInstanceTreeCreator method createDescriptorByNode.
@Override
public void createDescriptorByNode(Object node, ResultConsumer<Pair<XInstanceEvaluator, String>> resultConsumer) {
if (node instanceof XValueNodeImpl) {
XValueNodeImpl valueNode = (XValueNodeImpl) node;
resultConsumer.onSuccess(Pair.create(valueNode.getValueContainer().getInstanceEvaluator(), valueNode.getName()));
}
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerTreeCreator method createTree.
@NotNull
@Override
public Tree createTree(@NotNull Pair<XValue, String> descriptor) {
final XDebuggerTree tree = new XDebuggerTree(myProject, myProvider, myPosition, XDebuggerActions.INSPECT_TREE_POPUP_GROUP, myMarkers);
final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(), descriptor.getFirst());
tree.setRoot(root, true);
tree.setSelectionRow(0);
// expand root on load
tree.expandNodesOnLoad(node -> node == root);
return tree;
}
Aggregations