access table at runtime [message #516812] |
Thu, 25 February 2010 04:33 |
Eclipse User |
|
|
|
plz i have a problem in adding data to table in a view @ run time
//updatetable function is called at run time
// when i debug & points to the table i find accessible =null
setinput works only inside createPartControl
My code
@Override
public void createPartControl(Composite parent) {
tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL );
String[] columnNames = new String[] { "Tx_Id", "MsgID",
"Data" };
int[] columnWidths = new int[] { 75, 120, 75 };
int[] columnAlignments = new int[] { SWT.CENTER, SWT.CENTER,
SWT.CENTER };
for (int i = 0; i < columnNames.length; i++)
{
TableViewerColumn column = new
TableViewerColumn(tableViewer, SWT.NONE);
column.getColumn().setText(columnNames[i]);
column.getColumn().setWidth(columnWidths[i]);
column.getColumn().setResizable(true);
column.getColumn().setMoveable(true);
}
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer.setContentProvider(new ViewContentProvider());
tableViewer.setLabelProvider(new DataLabelProvider() );
HighActivator.getDefault().tr=this;
// here i can to call setinput and it works
Model m = new Model(Integer.toString(0),
Integer.toString(1), "12");
List<Model> model = new ArrayList<Model>();
model.add(m);
tableViewer.setInput(model);
}
wrong
thread !!
public void updateTable(List<Model> model1)
{
tableViewer.setInput(model1);
}
|
|
|
Powered by
FUDForum. Page generated in 0.06053 seconds