Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » how to know if cell was changed in tableviewer?
how to know if cell was changed in tableviewer? [message #1235219] Thu, 23 January 2014 20:59
Yossi Balan is currently offline Yossi BalanFriend
Messages: 10
Registered: May 2013
Junior Member
I created tableviewer ( jface ).

All the columns are editable ( using EditingSupport )

I want to know when cell is changed and then to raise a flag in other column. meaning that you start to write any data in the cell

I know that I need to create event of key changed listener to the cells. ( or there is different way )

How I can have access to the cell ? where do I need to add the event

T//he gridViewer Class

public class MyGridViewer extends TableViewer {
public MyGridViewer (Composite parent) {
super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);

final Table table = this.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);

this.setContentProvider(new MyModelProvider());

}
}


@Override
protected void inputChanged(Object input, Object oldInput) {

removeColumn();



tableCol = new TableViewerColumn(this, SWT.NONE);
column = tableCol.getColumn();
column.setText(dataColumnHeader.getName());
column.setWidth(100);
column.setResizable(true);
column.setMoveable(true);
tableCol.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
DataRow r = (DataRow) element;
DataCell c = r.getDataCellByName(dataColumnHeader.getName());
if (c != null && c.getValue() != null) {
return c.getValue().toString();
}
return null;
}
});


editingSupport = new StringCellEditingSupport(this, dataColumnHeader);
tableCol.setEditingSupport(editingSupport);
super.inputChanged(input, oldInput);

}
Previous Topic:How to get the right value in tableviewer
Next Topic:how to add image to cell
Goto Forum:
  


Current Time: Thu Apr 18 15:05:08 GMT 2024

Powered by FUDForum. Page generated in 0.01410 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top