|
|
Re: Key binding for action in Eclipse 3.1 ? [message #289428 is a reply to message #289216] |
Fri, 05 August 2005 00:57 |
Eclipse User |
|
|
|
Originally posted by: user.domain.invalid
Thanks R. That worked right away. Looks like my bindings where colliding
with other JDT bindings just as you suggested. Again... Thanks!
Sincerly,
Martin
Roland Tepp wrote:
> I'm not quite shure if the problem is that you are trying to override a
> keybinding from org.eclipse.ui plugin or that you are using action id
> instead of command id in the binding.
>
> generally speaking - you need to define a command (an extension to
> org.eclipse.ui.commands extension point) in your plugin witht the same
> ID as commandId attribute value, and specify the same id as definitionId
> for your action definition.
>
> The code should look something like this:
> <extension point="org.eclipse.ui.commands">
> <command id="defid.source.menu.Rename"
> name="Rename"
> categoryId="Your.category.id"/>
> </extension>
> <extension point="org.eclipse.ui.bindings">
> <key sequence="F2"
> commandId="defid.source.menu.Rename"
> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
> </key>
> </extension>
> <extension point="org.eclipse.ui.actionSets">
> <actionSet ...>
> <action id="..."
> definitionId="defid.source.menu.Rename"
> .../>
> </actionSet>
> </extension>
>
> (excuse me if there are typos or I've missed something - the exact
> syntax is described in documentation for each extensionpoint)
>
> Martin Olsson kirjutas mulle ühel talvisel päeval midagi seesugust:
>
>>
>> I would like to bind a keyboard shortcut to one of my actions. This
>> particular action is a refactoring operation ("Rename...") that
>> operates on a custom editor that I've implemented myself. This
>> operation is located in the "Source" menu, which is only visible when
>> an instance of the custom editor is active.
>>
>> This is was my best guess so far, I added this to plugin.xml
>>
>> <extension point="org.eclipse.ui.bindings">
>> <key sequence="F2"
>> commandId="defid.source.menu.Rename"
>> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
>> </key>
>> </extension>
>>
>> But this did not work. Even though I see the action in the source menu
>> (and can use it by clicking on it), nothing happens when I click the
>> F2 button. Nor does any key binding label appear next to the
>> "Rename..." menu item.
>>
>> I've read about a zillion different ways to add key bindings to
>> actions. Which method is the latest one? I'm using Eclipse 3.1 at the
>> moment.
>>
>>
>> regards,
>> martin
>
>
|
|
|
Re: Key binding for action in Eclipse 3.1 ? [message #289441 is a reply to message #289216] |
Thu, 04 August 2005 22:59 |
Eclipse User |
|
|
|
Originally posted by: dcorbin.machturtle.com
Roland Tepp wrote:
> I'm not quite shure if the problem is that you are trying to override a
> keybinding from org.eclipse.ui plugin or that you are using action id
> instead of command id in the binding.
>
> generally speaking - you need to define a command (an extension to
> org.eclipse.ui.commands extension point) in your plugin witht the same
> ID as commandId attribute value, and specify the same id as definitionId
> for your action definition.
What is proper procedure, if some plugin defines a key binding "too
broadly", and you'd like to use the same binding subset context?
David
|
|
|
Re: Key binding for action in Eclipse 3.1 ? [message #289466 is a reply to message #289441] |
Fri, 05 August 2005 12:02 |
Eclipse User |
|
|
|
Originally posted by: douglas.pollock.magma.ca
David Corbin wrote:
> What is proper procedure, if some plugin defines a key binding "too
> broadly", and you'd like to use the same binding subset context?
Let's say the example is F5 -> Refresh. If you are simply going to
implement functionality that has the same semantic as "refresh" but
localized to the particular context, then you should just override the
handler.
If you are going to change the meaning entirely (e.g., Step Into), then you
define a context. The context should be a child of the context containing
the binding you wish to override. In this way, your binding will be given
priority.
The F5 example is a good one for overriding by context. Cut/copy/paste are
good examples of providing a different handler.
d.
|
|
|
Re: Key binding for action in Eclipse 3.1 ? [message #289509 is a reply to message #289466] |
Sat, 06 August 2005 00:19 |
Eclipse User |
|
|
|
Originally posted by: dcorbin.machturtle.com
Douglas Pollock wrote:
> David Corbin wrote:
>> What is proper procedure, if some plugin defines a key binding "too
>> broadly", and you'd like to use the same binding subset context?
>
> Let's say the example is F5 -> Refresh. If you are simply going to
> implement functionality that has the same semantic as "refresh" but
> localized to the particular context, then you should just override the
> handler.
>
> If you are going to change the meaning entirely (e.g., Step Into), then
> you
> define a context. The context should be a child of the context containing
> the binding you wish to override. In this way, your binding will be given
> priority.
>
> The F5 example is a good one for overriding by context. Cut/copy/paste
> are good examples of providing a different handler.
>
>
The specific case I'm talking about is "CTRL-ALT-X T" Run as JUnit Test. I
want to use it for "Run as Test::Unit Test" if the "selection" is
appropriate (since I don't think the currently selected thing can be both
Java and Ruby at the same time).
I'll look at the context definition.
Thanks.
>
> d.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03198 seconds