Refreshing View (Tableviewer) [message #464554] |
Thu, 24 November 2005 17:36 |
Eclipse User |
|
|
|
Originally posted by: danie.mouapi.dai-labor.de
Hi! ,
I've created a Tableviewer and I have the class selectionView that init the
tableviewer and it 's components. I have another class GuiData that adds
element to my tableviewer.
Where can I call the refresh method (table_viewer.refresh) to update my
table_viewer?
Thanks.
Below is some code:
public class SelectionView extends ViewPart {
......
private Table table = null;
TableViewer table_viewer;
@Override
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
top = new Composite(parent, SWT.NONE);
top.setLayout(new GridLayout());
createToolBar();
createTable();
}
....
.....
private void createTable() {
GridData gridData1 = new GridData();
gridData1.grabExcessHorizontalSpace = true;
.....
table_viewer = new TableViewer(table);
table_viewer.setContentProvider(new DeviceContentProvider());
table_viewer.setLabelProvider(new DeviceLabelProvider());
DeviceSelectionFilter dsf = new DeviceSelectionFilter();
dsf.setWantedDevice(Device.TYPES.CELLPHONE);
table_viewer.addFilter(dsf);
table_viewer.setSorter(new DeviceSelectionSorter());
//GUIData.getAllDevices()
try{
.Device[] devices= GUIData.getAllDevices();
table_viewer.setInput(devices);
}catch(Exception e){
e.getMessage();
.....
....
}
public TableViewer getViewer() {
return table_viewer;
}
}*************end class
public class GUIData{
.....
public static void addDevice(
Device device) {
if (device == null)
return;
if (contains(device)) {
return;
}
devices.put(device.getDeviceName(), device); //****** I want
update hier while device change
new SelectionView().getViewer().refresh();
}
......
}**** end class
|
|
|
|
Powered by
FUDForum. Page generated in 0.05533 seconds