Filtering Events between Parts [message #534006] |
Mon, 17 May 2010 17:21 |
|
Hi,
I am listening from one part to change events in another part
getSite().getPage().addPostSelectionListener(StocksView.VIEW_ID, this);
The problem is that I would like to filter these events in some occasions, depending on the location and the mouse button which is pressed. I've added a filter to the display:
m_table.getDisplay().addFilter(SWT.MouseDown, new Listener(){
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
*/
@Override
public void handleEvent(Event event) {
TableItem item = m_table.getItem(new Point(event.x, event.y));
if ( ( item != null) && (event.button == 3) ){ //right click
updateSelection();
event.type = SWT.NONE;
}
}
});
this filter filters the events from reaching other listeners of the table, but does not filter the event from reaching the listeners in other parts. How can I filter the events also from other parts?
Thanks,
Nir
[Updated on: Mon, 17 May 2010 17:22] Report message to a moderator
|
|
|
Re: Filtering Events between Parts [message #541331 is a reply to message #534006] |
Sun, 20 June 2010 08:08 |
Wim Jongman Messages: 423 Registered: July 2009 |
Senior Member |
|
|
Hi, Nir,
That would be a special implementation of ISelectionListener. It is a good
idea. Consider filing a bug for it with your implementation as a patch.
Best regards,
Wim
--
Best Regards,
Wim Jongman
-- Who's General Failure & why is he reading my disk?
(Eclipse Old Skool
Quote Service)
> Hi,
> I am listening from one part to change events in another part
>
> getSite().getPage().addPostSelectionListener(StocksView.VIEW _ID, this);
> The problem is that I would like to filter these events in some occasions,
depending on the location and the mouse button which is pressed. I've added a
filter to the display:
>
> m_table.getDisplay().addFilter(SWT.MouseDown, new Listener(){
> /* (non-Javadoc)
> * @see
org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt .widgets.Event)
> */
> @Override
> public void handleEvent(Event event) {
> TableItem item = m_table.getItem(new Point(event.x, event.y));
> if ( ( item != null) && (event.button == 3) ){ //right click
> updateSelection();
> event.type = SWT.NONE;
> }
> }
> });
>
> this filter filters the events from reaching other listeners of the table,
but does not filter the event from reaching the listeners in other parts. How
can I filter the events also from other parts?
> Thanks,
> Nir
|
|
|
Powered by
FUDForum. Page generated in 0.03007 seconds