Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Conflict in keys shortcuts
Conflict in keys shortcuts [message #696158] Wed, 13 July 2011 11:41 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 #698076 is a reply to message #698066] Mon, 18 July 2011 18:11 Go to previous messageGo to next message
Eclipse UserFriend
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 #698086 is a reply to message #698076] Mon, 18 July 2011 18:29 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Re: Conflict in keys shortcuts [message #698146 is a reply to message #698086] Mon, 18 July 2011 21:22 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Conflict in keys shortcuts [message #698415 is a reply to message #698146] Tue, 19 July 2011 12:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eclipse User wrote on Mon, 18 July 2011 17:22
Originally posted by: Martin Jedlicka

Option 1: Ok, I see.
Option 2: How do I implement this? It is possible to give an example?


That's just standard commands/handlers. See some of the links below:

http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench.htm

Also check out the command contributions example:
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.ui.examples.contributions

PW



Re: Conflict in keys shortcuts [message #698573 is a reply to message #698415] Tue, 19 July 2011 17:36 Go to previous message
Eclipse UserFriend
Originally posted by: Martin Jedlicka

Thank you very much Paul!

M.

Dne 19.7.2011 14:48, Paul Webster napsal(a):
> Eclipse User wrote on Mon, 18 July 2011 17:22
>> Originally posted by: Martin Jedlicka
>>
>> Option 1: Ok, I see.
>> Option 2: How do I implement this? It is possible to give an example?
>
>
> That's just standard commands/handlers. See some of the links below:
>
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
> http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench.htm
>
>
> Also check out the command contributions example:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.ui.examples.contributions
>
>
> PW
>
>
Previous Topic:How to override plugin_customization.ini from a fragment
Next Topic:How to control view location when attaching (un-detached)it?
Goto Forum:
  


Current Time: Tue Mar 19 05:23:12 GMT 2024

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

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

Back to the top