|
Re: Use of Display.addFilter() in practice [message #555547 is a reply to message #555509] |
Fri, 27 August 2010 06:53 |
|
Lakshmi P Shanmugam Messages: 279 Registered: July 2009 Location: India |
Senior Member |
|
|
Hi,
When you add say a KeyUp filter to the Display, you'll be notified of a KeyUp event happening on any widget belonging to this Display and the Listener code will be executed each time. So, the performance impact is only because your listener code runs on every/any KeyUp event. But, when you add a listener to a widget, you'll listener code runs only when the event happens on your widget.
If you are interested in the listening to the events only on a particular shell, you can try if this works for you. Add the filter when the shell is activated and remove it once the shell is deactivated. So, you'll notified only when KeyUp events happen in your shell.
shell.addShellListener(new ShellAdapter() {
public void shellActivated(ShellEvent e) {
display.addFilter(SWT.KeyUp, listener);
}
public void shellDeactivated(ShellEvent e){
display.removeFilter(SWT.KeyUp, listener);
}
});
For the last part of your question, I think you can customize the command+W behavior on Mac for your RCP application, please ask this question in the Platform UI forum to get the right answer.
HTH,
Lakshmi P Shanmugam
|
|
|
|
Powered by
FUDForum. Page generated in 0.03280 seconds