简体   繁体   English

Eclipse RCP中每个角度的键绑定

[英]Keybindings on a per-perspective basis in Eclipse RCP

I have an Eclipse RCP application which uses some bindings from org.eclipse.ui.defaultAcceleratorConfiguration in addition to its own keybindigs, which are defined through the extension org.eclipse.ui.binding . 我有一个Eclipse RCP应用程序,它除了通过扩展名org.eclipse.ui.binding定义的自己的keybindigs外,还使用了org.eclipse.ui.defaultAcceleratorConfiguration中的一些绑定。 I defined my own binding scheme and set the defaultAcceleratorConfiguration as parentId , then activated that scheme from plugin_customization.ini so that I can override some binding 我定义了自己的绑定方案,并将defaultAcceleratorConfiguration设置为parentId ,然后从plugin_customization.ini激活了该方案,以便可以覆盖某些绑定

Currently, nearly all of my commands are in the org.eclipse.ui.contexts.window context. 当前,几乎所有我的命令都在org.eclipse.ui.contexts.window上下文中。 However, I would like some binding to only take effect when a certain perspective is selected. 但是,我希望某些绑定仅在选择了某个角度后才生效。

How could I change the current context so that when a perspective is selected or loaded (upon application launch, for example) a certain context is activated, then revert to the window context when it is deselected? 如何更改当前上下文,以便在选择或加载透视图时(例如,在应用程序启动时)激活某个上下文,然后在取消选择它时还原为窗口上下文? I am looking for a solution that interferes other perspectives minimally, that is, it should be able to be used by several perspectives in the workbech. 我正在寻找一种解决方案,它可以最小程度地干扰其他观点,也就是说,它应该可以在工作流中的多个观点中使用。

I did some IPerspectiveListener3 trickery that indeed works. 我做了一些IPerspectiveListener3 ,但确实IPerspectiveListener3 I activate the context when my perspective is activated, and deactivate it upon perspective deactivation. 当激活我的透视图时,我将激活上下文,而在取消透视图时将其禁用。 However, I wonder whether a less hackish solution exists. 但是,我想知道是否存在一种较简单的解决方案。

I went with the IPerspectiveListener3 approach, and didn't run into any regressions. 我采用了IPerspectiveListener3方法,并且没有遇到任何回归。 Yet. 然而。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM