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.






6 responses to “Only one filled column in a JFace TableViewer”

  1. Christian

    Thanks, you saved my day and prevented me from becoming totally insane ;-).

  2. Anonymous

    Thanks, i met the same problem!

  3. Anonymous

    Bless you!

  4. Elias Baixas

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

  5. Kelt

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

  6. Robert

    Thanks so much!