本文介绍了添加键盘事件以在IPageLayout下切换ViewPart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为开关焦点分配不同视点上的键?
how to assign key for switch focus on different viewpart??
示例:(按 SWT.F7将焦点放在viewpartA上,按 SWT.F8专注于viewpartB)
example: (press "SWT.F7" to focus on viewpartA, "SWT.F8" to focus on viewpartB)
public class UserPerspective implements IPerspectiveFactory{
......
......
public void createInitialLayout(IPageLayout layout){
final IFolderLayout leftPanel = layout.createFolder(......);
leftPanel.addView(viewpartA.ID);
final IFolderLayout rightPanel = layout.createFolder(......);
rightPanel.addView(viewpartB.ID);
}
}
推荐答案
您可以使用以下按键绑定。请仔细阅读该序列的文档-这有点棘手:-)
You can use the following key bindings. Read the documentation for the sequence carefully - it is a little tricky :-)
下面的 value
属性是您的目标视图的ID。
The value
attribute below is the ID for your target view.
<extension
point="org.eclipse.ui.bindings">
<key
commandId="org.eclipse.ui.views.showView"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="F6">
<parameter
id="org.eclipse.ui.views.showView.viewId"
value="com.rcpcompany.so.ed.view">
</parameter>
</key>
<key
commandId="org.eclipse.ui.views.showView"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="SHIFT+F6">
<parameter
id="org.eclipse.ui.views.showView.viewId"
value="com.rcpcompany.so.ed.view1">
</parameter>
</key>
</extension>
这篇关于添加键盘事件以在IPageLayout下切换ViewPart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!