2

I want to get the text width in pixels of each tree item from a TreeViewer having 2 columns, so that I can get the maximum sized tree item to fix it as its respective column's width.

I have already tried using pack method, but it doesn't solve my purpose, as it fits column width to content size for the 1st level items, but not from 2nd level onward.

Please suggest any other way to autofit the column width to content size in JFace TreeViewer in Java.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Amy
  • 21
  • 2
  • Maybe look at using `StyledCellLabelProvider` or `ColumnLabelProvider` where you can access the current item info in the `ViewerCell` in the `update` method – greg-449 Jul 31 '21 at 12:37

0 Answers0