Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsshortcut keys in context menu disappear in second occurrence
https://www.eclipse.org/forums/index.php/mv/msg/148036/465807/#msg_465807
When I first bring up the context menu, I can see the shortcut keys right
beside the menuitem text, e.g. "action1 Ctrl+Shift+F", but if I leave
the current editor, and bring up another kind of editor, that is to make
the current editor to be out of focus, then come back to the previous
editor, and bring up the context menu again, the shortcut keys for
menutiems disappear, the context menu just show "action1 ". Is
this a bug in eclipse or it is something that I have not done correctly?
Below is what I did.
In plugin xml:
<extension
point="org.eclipse.ui.editors">
<editor
name="%Editor.name"
default="false"
extensions="abc"
contributorClass="...AbcActionContributor"
class="...AbcEditor"
id="...Abc"
</editor>
</extension>
<extension
point="org.eclipse.ui.contexts">
<context
name="%KeyBindings.context.esql.label"
description="%KeyBindings.context.esql.description"
parentId="org.eclipse.ui.textEditorScope"
id="com.ibm.etools.mft.esql.editor.context">
</context>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
name="%KeyBindings.label"
description="%KeyBindings.description"
id="abc.editor.category">
</category>
<command
name="%KeyBindings.command.comment.label"
description="%KeyBindings.command.comment.description"
categoryId="abc.editor.category"
id="abc.editor.comment">
</command>
</extension>]]>No real name2007-04-05T18:08:29-00:00Re: shortcut keys in context menu disappear in second occurrence
https://www.eclipse.org/forums/index.php/mv/msg/148036/465808/#msg_465808
note. This is what I did:
In AbcActionContributor, when creating action1, I set
action1.setActionDefinitionId("abc.editor.action1");
action1.setId("abc.editor.action1");
In the createPartControl() of AbcEditor, I did the following:
IHandlerService keyBindings = (IHandlerService) site.getService(
IHandlerService.class );
keyBindings.activateHandler( action1.getId(), new ActionHandler( action1 )
);
IContextService contextService = (IContextService)
getSite().getService(IContextService.class);
contextService.activateContext( "abc.editor.context" );]]>No real name2007-04-05T18:20:14-00:00Re: shortcut keys in context menu disappear in second occurrence
https://www.eclipse.org/forums/index.php/mv/msg/148036/465811/#msg_465811
In the createPartControl() of AbcEditor, I did the following:
IHandlerService keyBindings = (IHandlerService) site.getService(
IHandlerService.class );
keyBindings.activateHandler( action1.getId(), new ActionHandler( action1
) );
that should activate your ActionHandler for the abc.editor.action1
command, and activate your context whenever your editor is the active
editor.
What are you using to show the label in the context menu? Are you just
adding action1 to the context menu in createPartControl(*)?
There might already be an open bug about this (sounds familiar).
PW]]>Paul Webster2007-04-05T19:20:32-00:00Re: shortcut keys in context menu disappear in second occurrence
https://www.eclipse.org/forums/index.php/mv/msg/148036/465814/#msg_465814
org.eclipse.jface.action, I just do setText() from a properties file.]]>No real name2007-04-05T20:13:20-00:00Re: shortcut keys in context menu disappear in second occurrence
https://www.eclipse.org/forums/index.php/mv/msg/148036/466280/#msg_466280
PW]]>Paul Webster2007-04-17T13:19:27-00:00