final Dimension scrollableSize = renderer.computePreferredSize(true);
bounds.width = scrollableSize.width;
}
}
final ActionCallback callback = new ActionCallback();
if (!tree.isRowSelected(row)) {
if (addToSelection) {
tree.getSelectionModel().addSelectionPath(tree.getPathForRow(row));
} else {
tree.setSelectionRow(row);
}
}
if (bounds != null) {
final Range<Integer> range = getExpandControlRange(tree, path);
if (range != null) {
int delta = bounds.x - range.getFrom().intValue();
bounds.x -= delta;
bounds.width -= delta;
}
if (visible.width < bounds.width) {
bounds.width = visible.width;
}
final Rectangle b1 = bounds;
final Runnable runnable = new Runnable() {
public void run() {
tree.scrollRectToVisible(b1);
callback.setDone();
}
};
if (ApplicationManager.getApplication().isUnitTestMode()) {
runnable.run();
} else {
SwingUtilities.invokeLater(runnable);
}
} else {
callback.setDone();
}
return callback;
}