Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Main menu drop down event and mouse hover on Main menus.
Re: Main menu drop down event and mouse hover on Main menus. [message #658689] Wed, 09 March 2011 13:20 Go to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/08/2011 02:24 PM, amir wrote:
> 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).

Can you even do that in SWT? ... I mean, highlight a specific menu
item? I know you can't highlight more than one, and at least on GTK you
can't do other things while the SWT Menu is showing.

2 things come to mind.

1) go to the Menu snippets on http://www.eclipse.org/swt/snippets/ like
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.sn ippets/src/org/eclipse/swt/snippets/Snippet29.java?view=co
and try and get the menu to do what you want. You have full access to
all the SWT widgets.

2) have a look at subclasses of
org.eclipse.ui.internal.quickaccess.QuickAccessProvider as used from
org.eclipse.ui.internal.quickaccess.QuickAccessDialog. It scans the
different parts of the system, allowing users to find what they're
looking for and maintains a "suggestions" section (recently used). You
can see quick access in action using CTRL+3

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 and mouse hover on Main menus. [message #658803 is a reply to message #658689] Wed, 09 March 2011 20:30 Go to previous messageGo to next message
amir  is currently offline amir Friend
Messages: 16
Registered: September 2010
Junior Member
Dear Paul Webster
To make things more clearer , here a picture of what iam trying to do:
http://img218.imageshack.us/i/recommend.jpg

My project is to collect data (command ids of main menu items) and recommend to users for using main menu items, similar for movies recommendation system.
So what i am trying to figure out , is how i draw , highlight or do some hint at the main menu (Search) so the user gonna notice that?
i heard about mnemonics (Alt) maybe it gonna do the job, but could not find its source code.

Thanks for help (The Ctrl+3 really needed it with my project Smile )

p.s : SWT is my second option doing that, i am trying to find if it possible doing it with the first option, if not, need to prove that to my Tutor.

[Updated on: Wed, 09 March 2011 20:31]

Report message to a moderator

Re: Main menu drop down event and mouse hover on Main menus. [message #658940 is a reply to message #658803] Thu, 10 March 2011 13:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/09/2011 03:30 PM, amir wrote:
> My project is to collect data (command ids of main menu items) and
> recommend to users for using main menu items, similar for movies
> recommendation system. So what i am trying to figure out , is how i draw
> , highlight or do some hint at the main menu (Search) so the user gonna
> notice that?

You're just gonna have to try some different algorithms. But you can't
access the SWT parts of the main menu, at least not really. QuickAccess
is how we expose a search/recommend type interface to the user.

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 and mouse hover on Main menus. [message #659000 is a reply to message #658940] Thu, 10 March 2011 16:23 Go to previous messageGo to next message
amir  is currently offline amir Friend
Messages: 16
Registered: September 2010
Junior Member
Hey
and what about mouse hovering over main menu? is there away to print the main menu when i hover with the mouse over the menu?
Also in this example http://www.java2s.com/Tutorial/Java/0280__SWT/MenuShowAction Listener.htm , when i click on menu it prints something, can i accomplish that with main menus?

Thanks for help.

[Updated on: Thu, 10 March 2011 17:37]

Report message to a moderator

Re: Main menu drop down event and mouse hover on Main menus. [message #659046 is a reply to message #659000] Thu, 10 March 2011 19:20 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/10/2011 11:23 AM, amir wrote:
> Hey
> and what about mouse hovering over main menu? is there away to print the
> main menu when i hover with the mouse over the menu?

What do the SWT APIs say for Menu/MenuItem and their associated listeners?

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 and mouse hover on Main menus. [message #659053 is a reply to message #659046] Thu, 10 March 2011 19:43 Go to previous messageGo to next message
amir  is currently offline amir Friend
Messages: 16
Registered: September 2010
Junior Member
Hey
didn't understand your question clearly , however as i see in the code , The printing of "File" happens when the menu cascades, so the listener listen to the menu with SWT.Show property :
Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
fileMenu.addListener(SWT.Show, showListener);

That What i see, i am asking if this thing is possible with top level main menu ? for example if there some method GetMenu("File")...addListener(SWT.Show, showListener);

thanks
Re: Main menu drop down event and mouse hover on Main menus. [message #659192 is a reply to message #659053] Fri, 11 March 2011 12:47 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 03/10/2011 02:43 PM, amir wrote:
> That What i see, i am asking if this thing is possible with top level
> main menu ? for example if there some method
> GetMenu("File")...addListener(SWT.Show, showListener);

As mentioned, there's no API exposed to access the main menu. You can
get at it using internals, or non-guaranteed low-level APIs.

workbenchWindow.getShell().getMenuBar() for example, give the top menu
bar. It may or may not be filled, and its contents change based on a
set of events and data.

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 and mouse hover on Main menus. [message #659373 is a reply to message #659192] Sun, 13 March 2011 00:36 Go to previous message
amir  is currently offline amir Friend
Messages: 16
Registered: September 2010
Junior Member
Very Happy
wonderful. i think this solves my problem:
private MenuListener menuListener = new MenuListener() {
		
		@Override
		public void menuShown(MenuEvent e) {
			System.out.println(e);
			
		}
		
		@Override
		public void menuHidden(MenuEvent e) {
			System.out.println(e);
			
		}
	};
getSite().getWorkbenchWindow().getShell().getMenuBar().addMenuListener(menuListener);
	getSite().getWorkbenchWindow().getShell().getMenuBar().removeMenuListener(menuListener);
		

Thanks again
Previous Topic:2 different editors
Next Topic:Dynamically load class at runtime
Goto Forum:
  


Current Time: Tue Apr 23 17:10:09 GMT 2024

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

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

Back to the top