Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Main menu drop down event .(How to?)
Main menu drop down event . [message #658612] Wed, 09 March 2011 09:19 Go to next message
amir  is currently offline amir Friend
Messages: 16
Registered: September 2010
Junior Member
A part my project is to build plug-in to recommend for menuitems in the main menu of eclipse. So i need some sort of highlight at menuItem when i drop down menu(File).
I know for example to Listen for command From menuItem with this code:
private IExecutionListener listener = new IExecutionListener() {
		
		@Override
		public void postExecuteSuccess(String commandId, Object returnValue) {
			System.out.println(commandId);
}
		
	};
	
	public void setWorkbench(IWorkbench workbench) {	
		getCommandService(workbench).addExecutionListener(listener);
	}

	public void unsetWorkbench(IWorkbench workbench) {
		getCommandService(workbench).removeExecutionListener(listener);
	}
	
	private ICommandService getCommandService(IWorkbench workbench) {
		return (ICommandService)workbench.getAdapter(ICommandService.class);
	}


so now i need something similar to it(if it possible) to listen for drop down even, or mouse hover event, anything that helps me to Listen.

hope this explains my problem.

Another question is how i listen to every thing in the workbench while hovering with the mouse? i mean when my mouse for example hovers over toolbar item or menu item, it tells me that?

thanks
Re: Main menu drop down event . [message #658672 is a reply to message #658612] Wed, 09 March 2011 12:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There is no API to deal with the main menu bar (other than contributing
via actionSets or org.eclipse.ui.menus), or an RCP app creating
MenuManager in its ActionBarAdvisor.

That being said, there are ways to listen for the SWT events (SWT.Show
for a menu, SWT.Arm for a MenuItem) ... but you need to add listeners to
the widgets.

There is the notion of a display filter in SWT, but 1) the filter is run
on every event, 2) it's extremely dangerous, and 3) in the case of menus
and menu items, the filter sees the event *before* the SWT widgets are
actually created by the application.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Main menu drop down event . [message #658691 is a reply to message #658612] Wed, 09 March 2011 13:23 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Also, take this conversation to eclipse.platform as well, please :-)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Project Path in the target directory
Next Topic:info on servlet bridget
Goto Forum:
  


Current Time: Tue Dec 23 00:16:11 GMT 2014

Powered by FUDForum. Page generated in 0.01596 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software