Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-dev] ISelectionProvider implementation for Swing

Hi all,

I'm struggling with my own implementation of ISelectionProvider. I'm
developing RCP application using SWT_AWT bridge to create Swing table
on top of SWT. There are 2 views in the perspective, one with the
Swing table, another one is the default properties view. I want to
display currently selected row properties in the properties view. The
table item implements IPropertySource and IAdaptable. I'm setting the
selection provider inside createPartControl of my table view:
..
this.getSite().setSelectionProvider(new myprovider);
..

The application works partially. It means that when I select the table
row the properties view is not populated but when I first click on the
properties view (change the focus) and then click on the table row the
properties are set according to the last table row selected.

It looks like sometimes the method getSelection() is called and this
part works fine but probably the notifications are not working. I
checked that and I'm firing events for each ISelectionProvider
listener..

final SelectionChangedEvent e = new SelectionChangedEvent(this, new
StructuredSelection( mydata);

Object[] listenerList = postSelectionChangedListeners.getListeners();
for(int i=0; i<listenerList.length; i++) {
	final ISelectionChangedListener list =
(ISelectionChangedListener)listenerList[i];
       SafeRunnable.run(new SafeRunnable() {
           	public void run() {
             		list.selectionChanged(e);
              	}                	
       });
}

Any suggestions are welcome.

Regards,

Marcin


Back to the top