I am using a Nattable inside a eclipse ViewPart
. My RCP application is such that, each time I open the view, the table can have different columns based on the datamodel(represented by a different POJO) I wish to display.In short, can I do something like the below? :
`
IWorkBenchPage page = .....;
MyView view = page.openView(MyViewID,"myview",VIEW_ACTIVATE);
IDataProvider dp = ....;
// the following statement will set the dataprovider, the necessary layers
view.dataProvider(dp);
view.getTable().refresh();
....
`
I Believe this is possible, if you change the data provider (including the column accessor).
I have a similar situation in my product, and I found that the easiest way is to dispose the old table and recreate a new table with the new data.