Community
Participate
Working Groups
I tried attaching menu listeners to the Dock menu (TaskItem.setMenu), but they are never fired. Not sure of whether it is a bug/limitation of Dock Menus
This works fine for me with 3.6 Cocoa. Can you post a sample app that isn't working? I modified Snippet336 to create a menu and added it to the TaskItem returned from getTaskBarItem().
Created attachment 172308 [details] Patch to Snippet 336 I've added SelectionListener and MenuListener. SelectionListener is fired, but MenuListener isn't
(In reply to comment #2) > I've added SelectionListener and MenuListener. SelectionListener is fired, but > MenuListener isn't Thanks -- now that I re-read the description it's obvious that was what you were describing in the first place! I'll have a look.
The dock menu is a strange animal because the application delegate provides a callback with an NSMenu, but the actual NSMenu doesn't get used. The normal menuDidOpen notification doesn't fire. However, it looks like the menu is requested every time you right-click on the dock, so we can call menuDidOpen just before returning the menu. That will send SWT.Show and you'll get the menuShown() callback. Is that enough for now? I can't find a notification for the menu being closed, so we may not be able to send that.
Created attachment 172367 [details] Fix to call menuWillOpen Change adds call to menu.menuWillOpen before we return it to the dock. There's no notification that the dock closed, however, so I don't think we can report it.
Silenio, what do you think about this? I think it's better than nothing -- I verified we get asked for the dock menu every time you click on the dock, so we can always send the Show event, but not the Hide event.
We cannot provide this API for cocoa only. We need to see if it is possible to implement it on Windows7 as well. And I am not sure the API makes sense since the task menu can be shown even if the application is not running. Note that this is only implemented on Windows7 right now, but it can be done on cocoa as well (NSDockTilePlugIn). So the menu content (items, text, image) has to be static. The main use of SWT.Show/SWT.Hide is for changing the menu dynamically (before the menu is shown). Prakash, what do you want to do with SWT.Show/SWT.Hide?
(In reply to comment #7) > We cannot provide this API for cocoa only. We need to see if it is possible to > implement it on Windows7 as well. And I am not sure the API makes sense since > the task menu can be shown even if the application is not running. Note that > this is only implemented on Windows7 right now, but it can be done on cocoa as > well (NSDockTilePlugIn). > > So the menu content (items, text, image) has to be static. The main use of > SWT.Show/SWT.Hide is for changing the menu dynamically (before the menu is > shown). Oh, I assumed this was something missing on Cocoa, but it looks like I misunderstood the purpose of TaskBar and TaskItem. NSDockTilePlugin is an interface for a bundle included in your app that the dock will call when the app is in the dock but not running. I'm not sure that's practical for the SWT.
(In reply to comment #7) > Prakash, what do you want to do with SWT.Show/SWT.Hide? I was experimenting of contribution of menu items thru the Command Framework. If it works well, we could possibly accept contributions to a uri like "menu:org.eclipse.ui.taskBar". Of course this can happen only when the application is running, but that should be good enough.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.