Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Refreshing View (Tableviewer)
Refreshing View (Tableviewer) [message #464554] Thu, 24 November 2005 17:36 Go to next message
Eclipse UserFriend
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
Re: Refreshing View (Tableviewer) [message #464558 is a reply to message #464554] Thu, 24 November 2005 18:57 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You will probably get a better response to this Eclipse Workbench question
on the eclipse platform newsgroup.

news://news.eclipse.org/eclipse.platform

"Danie Mouapi" <danie.mouapi@dai-labor.de> wrote in message
news:dm4tm1$jto$1@news.eclipse.org...
> 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
>
>
Previous Topic:readAndDispatch is blocking
Next Topic:FormPage best practices
Goto Forum:
  


Current Time: Tue Apr 23 14:50:23 GMT 2024

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

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

Back to the top