[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Linking View vs Editor(ISelectionProvider ISelectionListener)

>From your post it sounds like ..
You have a ViewPart with an embedded JFace TableViewer. And on selection-change of TableViewer, you want to do something else. Thats it or anything else to it ???

TableViewer - SELECTIONCHANGED EVENT-SOURCE
SomeApplicationClass - SELECTIONCHANGED EVENT-LISTENER

1. So you should listen as org.eclipse.jface.viewers.ISelectionChangedListener somewhere like this ...

[code]
class SomeApplicationClass implements ISelectionChangedListener
{	
	private TableViewer fTblViewer;/* get reference to external tableviewer somehow :-) */

	protected void someInitMethod()
	{		
		fTblViewer.addSelectionChangedListener(this);
	}

	public void selectionChanged(SelectionChangedEvent event)
	{
		if( event.getSource().equals(fTblViewer) )
		{

			/* get structured selection from the SelectionChangedEvent */
			IStructuredSelection selection = (IStructuredSelection) event.getSelection();

			/* do whatever you want with the selection which contains selected table-elements */
		}
	}	
}
[/code]

Hope that clears the mess.

Thanks
~Venkat
 

--
View in EZ forum: http://www.eclipsezone.com/eclipse/forums/m91954276.html