Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311975 - Approach described in Snippet46 doesn't seem to work for complex widget hierarchies
Summary: Approach described in Snippet46 doesn't seem to work for complex widget hiera...
Status: CLOSED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-06 17:03 EDT by Brian de Alwis CLA
Modified: 2010-05-07 09:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian de Alwis CLA 2010-05-06 17:03:15 EDT
Build-Id: 3.6 M7'ish (as provided with recent builds of e4)

I was trying the approach described in the SWT Snippet #46 to detect double-clicks in a populated composite.  I've added a bunch of other widgets to Snippet46, including nested Composites and Groups, with assorted callbacks, and it continue to work.

Unfortunately this approach (attaching a listener to the shell) doesn't work for an Eclipse view.  I'm not sure what's different about this situation, nor what is necessary to get the equivalent behaviour.

Steps to repeat:
1. From Eclipse, create a new view plugin (File > New > Plugin Project > ... > Plug-in with a view.
2. Open the view's SampleView.java.  Add the following at the bottom of the createPartControl() method:

		parent.getShell().addListener(SWT.MouseDoubleClick, new Listener() {
			public void handleEvent(Event event) {
				System.out.println("MouseDoubleClick");
			}});
		parent.getShell().addListener(SWT.MouseMove, new Listener() {
			public void handleEvent(Event event) {
				System.out.println("MouseMove");
			}});

On MacOS X, I see "MouseMove" only when the cursor is on the titlebar or at the very fringes of the window borders.  I never see "MouseDoubleClick" printlns.
Comment 1 Felipe Heidrich CLA 2010-05-07 09:18:37 EDT
Do you know that the shell is only getting the events because the composite is disabled, right ?

You can also use Display#addFilter to get all the events in the display.

Please reopen this problem when you cause the problem to fail in the snippet.
(I don't have any indication that you calling setEnable(false) for a composite and listening for mouse events in the composiste's parent).