Search code examples
javaeclipseeclipse-pluginswttreeviewer

SWT TreeViewer, trim string text in columns


I'm using a SWT TreeViewer to show some paths, is it possible to trim the path string to insert "..." (points) when the path is too long a is not fully visible in the tree column?

Something like this:

enter image description here

Thanks in advance


Solution

  • Ok, reading the TreeColumn code I have noticed that the TreeViewer add ellipsis (...) to the columns automatically, but only if the column index is > 0. So column 0 strings are not truncated.

    Try all eclipse views that uses a TreeView.

    Really I don't understand this behavior.