I have several views in my RCP project.
In one view I have a TableViewer
.
In another view I have a JFrame
with a Button
.
I want to update the data in the TableViewer
using the setInput()
method when I press the button in another view.
How do I do this?
EDIT:
Initial input to the table viewer:
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
tableViewer.setLabelProvider(new TableLabelProvider() );
tableViewer.setInput(TraceData.getTraceData()); // get realtime data
I add the listener to the tableViewer to listen to changes in the GUI
listener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart part, ISelection sel) {
if (!(sel instanceof IStructuredSelection))
return;
IStructuredSelection ss = (IStructuredSelection) sel;
Object o = ss.getFirstElement();
if (o instanceof Book) // something else in place of Book
tableViewer.setInput(TraceData.getSavedTraceData());
}
};
getSite().getPage().addSelectionListener(listener);
And the problem is how to make it react to a button event in another view? That is how to brodcast the JButton
press event and then listen to that event in this TreeViewer
.