Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Command shortcuts (key-bindings) are invisible and inactive in 3.2
Command shortcuts (key-bindings) are invisible and inactive in 3.2 [message #309718] Mon, 06 November 2006 11:46 Go to next message
Eclipse UserFriend
R3.2.1 (WinXP) to be precise

I have a bunch, some standard, some not; they were all working fine in 3.1.2, per the nice guide at
http://www.magma.ca/~pollockd/despumate/bindingsHowTo.html

As soon as I migrated to 3.2.1, and without having touched that part of the plugin.xml, the bindings
no longer work (and they are not displayed in the menu), until the user goes to Window -> Customize
Perspective -- it is not necessary actually to *do* anything in that dialogue, the bindings just
appear and become active after looking at it.

Is there something new in 3.2 that I need to do, is there something more I should have been doing in
3.1.2 and now my luck has run out, or is this an unintended side-effect/ bug in 3.2.1?

thanks,
Paul
Re: Command shortcuts (key-bindings) are invisible and inactive in 3.2 [message #309729 is a reply to message #309718] Mon, 06 November 2006 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Paul Keyser wrote:
> Is there something new in 3.2 that I need to do, is there something more
> I should have been doing in 3.1.2 and now my luck has run out, or is
> this an unintended side-effect/ bug in 3.2.1?


There shouldn't have been that big a difference in 3.2.1.

So you have a <command/> and a <binding/> ... Did you place your action
in the menu using an IMenuManager or using <action/> (in
org.eclipse.ui.actionSets or org.eclipse.ui.editorActions, etc)?

Do you have a handler, or are you just depending on the definitionId of
an action? Do you use setGlobalActionHandler(*)?

Things like IKeybindingService were deprecated in 3.2.0 ... maybe it
doesn't completely mirror the old service. If you could provide a slice
that doesn't work (i.e. one keybinding/command/action) I'd open a bug at
https://bugs.eclipse.org/bugs against Eclipse Platform UI.

The common extension case is to use org.eclipse.ui.commands and
org.eclipse.ui.bindings to create the command and keybinding.

Then use org.eclipse.ui.actionSets to add it to the main menu, and the
<action definitionId="commandId" .../> to hook the menu action to the
keybinding.

Later,
PW
Re: Command shortcuts (key-bindings) are invisible and inactive in 3.2 [message #309755 is a reply to message #309729] Tue, 07 November 2006 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Paul Webster wrote:
> So you have a <command/> and a <binding/> ... Did you place your action
> in the menu using an IMenuManager or using <action/> (in
> org.eclipse.ui.actionSets or org.eclipse.ui.editorActions, etc)?
>
> Do you have a handler, or are you just depending on the definitionId of
> an action? Do you use setGlobalActionHandler(*)?
>
> Things like IKeybindingService were deprecated in 3.2.0 ... maybe it
> doesn't completely mirror the old service. If you could provide a slice
> that doesn't work (i.e. one keybinding/command/action) I'd open a bug at
> https://bugs.eclipse.org/bugs against Eclipse Platform UI.
>

Currently I do not get deterministic behavior (sometimes the RCP comes up as described, sometimes it
*does* have all the bindings without the user having to open the Window -> Customize Perspective
dialog); the difference occurs without my having changed a thing in my code (java or xml). Weird.
But no point yet in opening a bug, thanks.

Meanwhile:
a) I never used IKeyBindingService at all.
b) I have several cases, some of which have handlers, most do not.
c) I call IActionBars.setGlobalActionHandler() for edit-actions (CTTL-C and the like) -- in the
editor, and in various text-action-handlers.

For example, I have "open"/CTRL-O and "new"/CTRL-N in one action-set, both using definitionId and a
command (and no Java code in my ActionBarAdvisor, and no action-handlers anywhere); CTRL-N uses an
existing binding (by using an org.eclipse definitionId) and CTRL-O uses one of my own:

<!--
The two extensions 'commands' and 'bindings' must precede
the extension "org.eclipse.ui.actionSets"
-->
<extension
point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.ui.category.file"
description="Open a saved query"
id="com.mun.ist.app.commands.OpenQuery"
name="Open Query"/>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.mun.ist.app.commands.OpenQuery"
contextId="org.eclipse.ui.contexts.window"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+O"/>
</extension>
<!-- must come after the command and binding definitions above -->
<extension
point="org.eclipse.ui.actionSets">
<actionSet
description="Opening or creating files"
id="com.mun.ist.app.fileActionSet"
label="Query-File Action Set"
visible="false">
<action
class="com.mun.ist.app.actions.OpenQueryAction"
definitionId="com.mun.ist.app.commands.OpenQuery"
icon="icons/open.PNG"
id="com.mun.ist.app.actions.OpenQuery"
label="&amp;Open Query..."
menubarPath="file/fileStart"
state="false"
style="push"
toolbarPath="file/fileStart"
tooltip="Open an existing query"/>
<!-- by reusing the id of the Eclipse-defined action,
we arrange to retarget its accelerator, per
http://www.magma.ca/~pollockd/despumate/bindingsHowTo.html
-->
<action
class="com.mun.ist.app.actions.NewQueryAction"
definitionId="org.eclipse.ui.newWizard"
icon="icons/newQuery.PNG"
id="com.mun.ist.app.actions.NewQuery"
label="&amp;New Query..."
menubarPath="file/fileStart"
state="false"
style="push"
toolbarPath="file/fileStart"
tooltip="Create a new query"/>
</actionSet>
</extension>

Comments welcome -- I could well be doing something sub-standard! :)

thanks,
Paul
Re: Command shortcuts (key-bindings) are invisible and inactive in 3.2 [message #309763 is a reply to message #309755] Tue, 07 November 2006 13:12 Go to previous message
Eclipse UserFriend
Paul, that command/binding/action for CTRL+O look correct to me.

Another thing I can suggest in the name of gathering information is to
run with some tracing options ...
http://wiki.eclipse.org/index.php/Platform_Command_Framework #Tracing_Option

If you use handlers.verbose restrict it to your commandId,
com.mun.ist.app.commands.OpenQuery


When you press your keys you should get lines like:
KEYS >>> Listener.handleEvent(type = KeyDown, stateMask = 0x60000,
keyCode = 0x74, time = 11308037, character = 0x14)
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+SHIFT+T])
KEYS >>> WorkbenchKeyboard.executeCommand(commandId =
'org.eclipse.jdt.ui.navigate.open.type', parameters = {})


In 3.2.x there is a bug on linux that sometimes will kill all of the
keybindings (it's a shell activation bug).

Later,
PW
Previous Topic:Property View/Editor Recursive Exception
Next Topic:themes (IThemeDescriptor, IThemeRegistry, etc.) in Eclipse 3.2 and beyond?
Goto Forum:
  


Current Time: Tue Jul 22 00:54:14 EDT 2025

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

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

Back to the top