Only one filled column in a JFace TableViewer

I prepared a TableViewer based view for a workshop today. And ran into a really, really nice problem. The TableViewer displayed all rows and columns, but only the first column was filled with data (since it was for demonstration purposes only I used some hardcoded data in an ArrayList). I checked everything, from LabelProvider to ContentProvider and the view itself. Finally I noticed (after a long, long time, it felt like weeks) that I was calling viewer.setInput(myArrayList) before setting the columns with TableColumn column = new TableColumn(…). Changing that solved my problem, all data was visible. I seems that JFace displays a simple list in this case, but sets all column headers and shows no error message at all.

Published by Dominik

Java architect, developer, author, trainer, speaker, JCrypTool project lead and secure programming enthusiast.

6 replies on “Only one filled column in a JFace TableViewer”

  1. Me tooooo !! thanks (it’s been like 2 hours, but could have been all night long :D )

  2. I’m joning to all above and many thanks! :)
    (I’ve got same problem and it’s already been killed 4 hours before.)

Comments are closed.