[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Linking View+Edito (ISelectionProvider, ISelectionListener)?

Have answered your similar post at eclipse.org...Just repeating the same....
--------

>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/m91954278.html