use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerTreeCreator method createDescriptorByNode.
@Override
public void createDescriptorByNode(Object node, ResultConsumer<Pair<XValue, String>> resultConsumer) {
if (node instanceof XValueNodeImpl) {
XValueNodeImpl valueNode = (XValueNodeImpl) node;
resultConsumer.onSuccess(Pair.create(valueNode.getValueContainer(), valueNode.getName()));
}
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XMarkObjectActionHandler method perform.
@Override
public void perform(@NotNull Project project, AnActionEvent event) {
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session == null)
return;
XValueMarkers<?, ?> markers = ((XDebugSessionImpl) session).getValueMarkers();
XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
if (markers == null || node == null)
return;
XValue value = node.getValueContainer();
boolean detachedView = DebuggerUIUtil.isInDetachedTree(event);
XDebuggerTreeState treeState = XDebuggerTreeState.saveState(node.getTree());
ValueMarkup existing = markers.getMarkup(value);
if (existing != null) {
markers.unmarkValue(value);
} else {
ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(event.getData(CONTEXT_COMPONENT), node.getName());
dialog.show();
ValueMarkup markup = dialog.getConfiguredMarkup();
if (dialog.isOK() && markup != null) {
markers.markValue(value, markup);
}
}
if (detachedView) {
node.getTree().rebuildAndRestore(treeState);
}
session.rebuildViews();
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerTreeRenderer method customizeCellRenderer.
public void customizeCellRenderer(@NotNull final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
myHaveLink = false;
myLink.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
XDebuggerTreeNode node = (XDebuggerTreeNode) value;
node.appendToComponent(this);
setIcon(node.getIcon());
Rectangle treeVisibleRect = tree.getParent() instanceof JViewport ? ((JViewport) tree.getParent()).getViewRect() : tree.getVisibleRect();
TreePath path = tree.getPathForRow(row);
int rowX = path != null ? getRowX((BasicTreeUI) tree.getUI(), row, path.getPathCount() - 1) : 0;
if (myHaveLink) {
setupLinkDimensions(treeVisibleRect, rowX);
} else {
int visibleRectRightX = treeVisibleRect.x + treeVisibleRect.width;
int notFittingWidth = rowX + super.getPreferredSize().width - visibleRectRightX;
if (node instanceof XValueNodeImpl && notFittingWidth > 0) {
// text does not fit visible area - show link
String rawValue = DebuggerUIUtil.getNodeRawValue((XValueNodeImpl) node);
if (!StringUtil.isEmpty(rawValue) && tree.isShowing()) {
Point treeRightSideOnScreen = new Point(visibleRectRightX, 0);
SwingUtilities.convertPointToScreen(treeRightSideOnScreen, tree);
Rectangle screen = ScreenUtil.getScreenRectangle(treeRightSideOnScreen);
// text may fit the screen in ExpandableItemsHandler
if (screen.x + screen.width < treeRightSideOnScreen.x + notFittingWidth) {
myLongTextLink.setupComponent(rawValue, ((XDebuggerTree) tree).getProject());
append(myLongTextLink.getLinkText(), myLongTextLink.getTextAttributes(), myLongTextLink);
setupLinkDimensions(treeVisibleRect, rowX);
myLinkWidth = 0;
}
}
}
}
putClientProperty(ExpandableItemsHandler.RENDERER_DISABLED, myHaveLink);
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerTreeActionBase method update.
@Override
public void update(final AnActionEvent e) {
XValueNodeImpl node = getSelectedNode(e.getDataContext());
e.getPresentation().setEnabled(node != null && isEnabled(node, e));
}
use of com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl in project intellij-community by JetBrains.
the class XDebuggerTreeActionBase method getSelectedNodes.
@NotNull
public static List<XValueNodeImpl> getSelectedNodes(DataContext dataContext) {
XDebuggerTree tree = XDebuggerTree.getTree(dataContext);
if (tree == null)
return Collections.emptyList();
TreePath[] paths = tree.getSelectionPaths();
if (paths == null || paths.length == 0) {
return Collections.emptyList();
}
return StreamEx.of(paths).map(TreePath::getLastPathComponent).select(XValueNodeImpl.class).toList();
}
Aggregations