java - Eclipse RCP: TableViewer setInput from another view -


I have many ideas in my RCP project.

I have a TableViewer in one view.

In another view I have a JFrame a button .

I want to update the data when I press the button in another view by using the Table in TableViewer using the setInput () method.

Edit:

Initial input in the table viewer:

  tableViewer.setContentProvider (ArrayContentProvider.getInstance ()); TableViewer.setLabelProvider (New TableLabelProvider ()); TableViewer.setInput (TraceData.getTraceData ()); // Get real-time data   

I connect the listener to the tableViewer to listen for changes in the GUI

  listener = new ISelectionListener () {public Void selectionChanged (IWorkbenchPart part, ISelection sel) {if ((! (Credited selection celebrity)) return; ICTCricard SS SS = (ISCCaraship) SL; Object o = ss.getFirstElement (); If (O Instance Book) // Book Table Weaver. Something else in place of the setting (TraceData.getSavedTraceData ()); }}; . GetSite () getPage () addSelectionListener (listener).  

And the problem is how do they respond to a button event in another view? jbutton To broadcast the event, and then listen to this event in the tree-wheeler .

In my RCP application, I have a visual class that is extended by all other people. I have this view:

  abstract zero refresh ();  

Now, you have to use the fresh method of view with table weaver.

  @ Override Public Zero Refresh () {tableViewer.setInput (... ..); TableViewer.refresh (); }  

and you will need to call the refresh method from the button

How to access another view.

  Last IWorkbenchWindow Window = PlatformUI.getWorkbench (). GetActiveWorkbenchWindow (); Last IWorkbench page page = window.getActivePage (); Try {if (page.getActivePart ()! = Null) {viewTitle = page.getActivePart () GetTitle (); View IViewPart = Page. ShowView (MainView.ID) // plugin. Id de la scene in xml page.hideview (page.findView (SitesView.ID)); }  

Comments