Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Inoperational shortcuts
Inoperational shortcuts [message #334201] Mon, 26 January 2009 15:22 Go to next message
Michael Piefel is currently offline Michael PiefelFriend
Messages: 12
Registered: July 2009
Junior Member
I posted this last week in *.swt, but that seems to have been the wrong
target
audience. In the JFace snippet below, the only interesting part is
createMenuManager(). I create a menu with a shortcut. However, the shortcut
is inoperational, that is, pressing CTRL-G does nothing. But once I have
opened the drop-down menu, the shortcut starts to work.

The delayed construction of MenuItem seems to harm the functionality here.
What can I do to circumvent that? I’m working under Windows, but it won’t
work for GTK either, I am told.

Bye,
Mike


import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;

public class ShortcutSnippet extends ApplicationWindow {

public ShortcutSnippet() {
super(null);
addMenuBar();
}

public static void main(final String args[]) {
final ApplicationWindow w = new ShortcutSnippet();
w.setBlockOnOpen(true);
w.open();
}

@Override
protected MenuManager createMenuManager() {
final MenuManager bar_menu = new MenuManager("");
final MenuManager dropdown_menu= new MenuManager("File");

dropdown_menu.add(new Action() {
{
setText("Greet");
setAccelerator(SWT.MOD1 | 'G');
}

@Override
public void run() {
MessageDialog.openInformation(null,
"Greet", "Hello World");
}
});

bar_menu.add(dropdown_menu);
return bar_menu;
}
}



--
Michael Piefel
netCCM GmbH
Re: Inoperational shortcuts [message #334210 is a reply to message #334201] Mon, 26 January 2009 18:49 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

This is fixed for JFace apps in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256314 eclipse Ganymede
SR2 (3.4.2) due out in Feb some time.

PW

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


Previous Topic:Update-site not found new features
Next Topic:Disappearing error markers in Projects Explorer
Goto Forum:
  


Current Time: Thu Nov 21 12:04:18 GMT 2024

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

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

Back to the top