@Override public void customizeCellRenderer(@Nonnull 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 = AbstractExpandableItemsHandler.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); }