Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] a question on Tableviewer

Try the following:

In your CellModifier do a call back to your main object that holds a
reference to your TableViewer OR do the call back on a reference to
the tableViewer. Either way you have to do the call back like the
following:

   private object APPLICATION_OBJECT_WITH_ REFERNCE_TO_TABLE_VIEWER;

    public void modify(Object element, String property, Object value) {
        TableItem tableItem = (TableItem) element;        
        Object[] row = (Object[]) tableItem.getData();
        ((TestTableCell)
row[Integer.valueOf(property)]).setCellContent( (String) value);
        tableItem.setData(row);
        APPLICATION_OBJECT_WITH_REFERNCE_TO_TABLE_VIEWER.refreshMyTestTableView();

    }

Then call refresh on the tableViewer.refresh().

Also you may have to do the following in you content provider:

    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        ((TableViewer) viewer).getTable().layout();
    }

-H


On 28 Feb 2005 00:42:06 -0800, Yan Chen <ychen5@xxxxxxxxxxxx> wrote:
> Hello,I got a problem of updating the tableview.
> 
> When the element in the model is changed and I call
> tableViewer.update(task,null); the view is suppose to update itself. But
> it was not working. I also call  tableViewer.refresh(), but still no
> luck.But I can add or remove a element by calling tableViewer.add(task)
> or tableViewer.remove(task) and it works.Do you guys have any suggestion
> on this updating problem? Thanks a lot.
> 
> Yan
> 
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>


Back to the top