Home » Eclipse Projects » Rich Client Platform (RCP) » Conflict in keys shortcuts
Conflict in keys shortcuts [message #696158] |
Wed, 13 July 2011 11:41 |
Eclipse User |
|
|
|
Originally posted by: Martin Jedlicka
Hi,
I have question on definition key binding. I have an RCP application
and in application two plugins 'poll.lsn.monitorvariable' and
'poll.lsn.recorddata'. I defined keys shortcuts CTRL+G in each plugin
this way:
Plugin 'poll.lsn.monitorvariable:
<command
categoryId="poll.lsn.monitorvariable.commands"
defaultHandler="poll.lsn.monitorvariable.actions.ChartPropertiesHandler"
id="poll.lsn.monitorvariable.command.chartproperties"
name="%poll.lsn.monitorvariable.command.chartproperties">
</command>
<key
commandId="poll.lsn.monitorvariable.command.chartproperties"
contextId="org.eclipse.ui.contexts.window"
schemeId="poll.lsn.scheme"
sequence="M1+G">
</key>
Plugin 'poll.lsn.recorddata':
<command
categoryId="poll.lsn.recorddata.commands"
defaultHandler="poll.lsn.recorddata.actions.ShowChartAndLogAnHandler"
id="poll.lsn.recorddata.command.showchartlogan"
name="%poll.lsn.recorddata.command.showchartlogan">
</command>
<key
commandId="poll.lsn.recorddata.command.showchartlogan"
contextId="org.eclipse.ui.contexts.window"
schemeId="poll.lsn.scheme"
sequence="M1+G">
</key>
After started my application occurred a conflict for CTRL+G:
!MESSAGE A conflict occurred for CTRL+G:
Binding(CTRL+G,
ParameterizedCommand(Command(poll.lsn.monitorvariable.command.chartproperties,Nastavení
grafu,
,
Category(poll.lsn.monitorvariable.commands,Sledování
proměnných,MonitorVariable commands,true),
poll.lsn.monitorvariable.actions.ChartPropertiesHandler,
,,true),null),
poll.lsn.scheme,
org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+G,
ParameterizedCommand(Command(poll.lsn.recorddata.command.showchartlogan,Zobrazení
analogového grafu / logického analyzátoru,
,
Category(poll.lsn.recorddata.commands,Záznamník
dat,RecordData commands,true),
poll.lsn.recorddata.actions.ShowChartAndLogAnHandler,
,,true),null),
poll.lsn.scheme,
org.eclipse.ui.contexts.window,,,system)
Is it possible somehow to resolve this error or do I have in my
application a unique keys shortcuts (Ctrl+G only once)? I'd rather solve
it somehow, but I do not know how.
Thanks.
Martin
|
|
|
Re: Conflict in keys shortcuts [message #696494 is a reply to message #696158] |
Thu, 14 July 2011 05:59 |
Eclipse User |
|
|
|
Originally posted by: Martin Jedlicka
Note:
Plugins 'poll.lsn.monitorvariable' and 'poll.lsn.recorddata' are in
different perspectives.
It is possible to have the same keys shortcuts in a variety of perspectives?
Martin
Dne 13.7.2011 13:41, Martin Jedlicka napsal(a):
> Hi,
>
> I have question on definition key binding. I have an RCP application and
> in application two plugins 'poll.lsn.monitorvariable' and
> 'poll.lsn.recorddata'. I defined keys shortcuts CTRL+G in each plugin
> this way:
>
> Plugin 'poll.lsn.monitorvariable:
>
> <command
> categoryId="poll.lsn.monitorvariable.commands"
>
> defaultHandler="poll.lsn.monitorvariable.actions.ChartPropertiesHandler"
> id="poll.lsn.monitorvariable.command.chartproperties"
> name="%poll.lsn.monitorvariable.command.chartproperties">
> </command>
>
> <key
> commandId="poll.lsn.monitorvariable.command.chartproperties"
> contextId="org.eclipse.ui.contexts.window"
> schemeId="poll.lsn.scheme"
> sequence="M1+G">
> </key>
>
> Plugin 'poll.lsn.recorddata':
>
> <command
> categoryId="poll.lsn.recorddata.commands"
>
> defaultHandler="poll.lsn.recorddata.actions.ShowChartAndLogAnHandler"
> id="poll.lsn.recorddata.command.showchartlogan"
> name="%poll.lsn.recorddata.command.showchartlogan">
> </command>
>
> <key
> commandId="poll.lsn.recorddata.command.showchartlogan"
> contextId="org.eclipse.ui.contexts.window"
> schemeId="poll.lsn.scheme"
> sequence="M1+G">
> </key>
>
> After started my application occurred a conflict for CTRL+G:
>
> !MESSAGE A conflict occurred for CTRL+G:
> Binding(CTRL+G,
>
> ParameterizedCommand(Command(poll.lsn.monitorvariable.command.chartproperties,Nastavení
> grafu,
> ,
> Category(poll.lsn.monitorvariable.commands,Sledování
> proměnných,MonitorVariable commands,true),
> poll.lsn.monitorvariable.actions.ChartPropertiesHandler,
> ,,true),null),
> poll.lsn.scheme,
> org.eclipse.ui.contexts.window,,,system)
> Binding(CTRL+G,
>
> ParameterizedCommand(Command(poll.lsn.recorddata.command.showchartlogan,Zobrazení
> analogového grafu / logického analyzátoru,
> ,
> Category(poll.lsn.recorddata.commands,Záznamník dat,RecordData
> commands,true),
> poll.lsn.recorddata.actions.ShowChartAndLogAnHandler,
> ,,true),null),
> poll.lsn.scheme,
> org.eclipse.ui.contexts.window,,,system)
>
> Is it possible somehow to resolve this error or do I have in my
> application a unique keys shortcuts (Ctrl+G only once)? I'd rather solve
> it somehow, but I do not know how.
>
> Thanks.
>
> Martin
|
|
|
Re: Conflict in keys shortcuts [message #698066 is a reply to message #696494] |
Mon, 18 July 2011 17:53 |
|
Your collision is happening because you've bound the same key to different commands in the window context (and you're in a window).
As an aside: Plugins aren't in any perspective, although they can provide one or more perspectives.
The 2 most common contexts that key shortcuts are defined in are "In Windows" or in a specific part.
You have 3 choices.
1) define the commands and keybindings as if they all exist at the window level. That way there's no conflict.
2) define one command and one keybinding, and different handlers per perspective (or part). That's how a common action like Refresh is defined (one command, one keybinding, multiple handlers).
3) define 2 different contexts, one for each perspective, and activate/deactivate them on perspective change.
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: Conflict in keys shortcuts [message #698076 is a reply to message #698066] |
Mon, 18 July 2011 18:11 |
Eclipse User |
|
|
|
Originally posted by: Martin Jedlicka
Thanks Paul!
I don't understand choice 1. What do you mean? It is possible to give an
example?
M.
Dne 18.7.2011 19:53, Paul Webster napsal(a):
> Your collision is happening because you've bound the same key to
> different commands in the window context (and you're in a window).
>
> As an aside: Plugins aren't in any perspective, although they can
> provide one or more perspectives.
>
> The 2 most common contexts that key shortcuts are defined in are "In
> Windows" or in a specific part.
>
> You have 3 choices.
>
> 1) define the commands and keybindings as if they all exist at the
> window level. That way there's no conflict.
>
> 2) define one command and one keybinding, and different handlers per
> perspective (or part). That's how a common action like Refresh is
> defined (one command, one keybinding, multiple handlers).
>
> 3) define 2 different contexts, one for each perspective, and
> activate/deactivate them on perspective change.
>
> PW
>
|
|
| |
Re: Conflict in keys shortcuts [message #698146 is a reply to message #698086] |
Mon, 18 July 2011 21:22 |
Eclipse User |
|
|
|
Originally posted by: Martin Jedlicka
Option 1: Ok, I see.
Option 2: How do I implement this? It is possible to give an example?
M.
Dne 18.7.2011 20:29, Paul Webster napsal(a):
> For option 1, I mean picking non-conflicting keys for your commands. ex:
>
> CTRL+5 G -> poll.lsn.monitorvariable.command.chartproperties
> CTRL+4 G -> poll.lsn.recorddata.command.showchartlogan
>
> Or another approach, why not have the chart properties tied to the
> already provided
> org.eclipse.ui.IWorkbenchCommandConstants.FILE_PROPERTIES command? Then
> you just provide a handler, and ALT+ENTER is the standard shortcut for
> Properties.
>
>
> Later,
> PW
|
|
| | |
Goto Forum:
Current Time: Tue Sep 24 09:04:09 GMT 2024
Powered by FUDForum. Page generated in 0.05085 seconds
|