Project Explorer (2) - 给"Build Project" 添加快捷键
来源:互联网 发布:qq游戏无法连接网络 编辑:程序博客网 时间:2024/06/05 04:49
背景介绍
CDT并没有给"Build Project"添加快捷键,而Wind River的Workbench则有。添加快捷键给常用操作,比用鼠标点图标更适合我的喜好。目标
给[1]中添加的"Build Project" Action添加快捷键控制。分析
在Workbench中,也没有把"Clean Project"加入到Windows Menu "Project"里面去。所以这里只给"Build Project"添加快捷键。
2]的6.6写道
"The new approach involves associating actions and key bindings with commands and grouping those commands into categories. In addition, each command has a scope indicating when it will be available to the user, and is part of a configuration so that the user can select between different configuration to get different key bindings."我们需要在显示地将Command和Key Bindings关联起来。
实现
修改 window menu command, "Build Project/Project".
在org.eclipse.ui.ide这个插件的plugin.xml中,可以找到Build Project Command的id: org.eclipse.ui.project.buildProject。
在我们的插件中,对这个command加入Key Binding.
<keyBinding
command="org.eclipse.ui.project.buildProject"
configuration="org.eclipse.ui.defaultAcceleratorConfiguration"
string="Ctrl+B Ctrl+P">
</keyBinding>
启动ide后,在Eclipse-->Window-->Preference-->General-->Keys,就能看到这个命令加入了 Ctrl+B Ctrl+P的绑定了。
Modifying Navigator.
在[1]中给出的ActionGroup中,给Build Action添加definitionId:
protected void makeActions() {
fBuildAction = new BuildAction(getViewPart().getSite(), IncrementalProjectBuilder.INCREMENTAL_BUILD);
fCleanAction= new BuildAction(getViewPart().getSite(), IncrementalProjectBuilder.CLEAN_BUILD);
fBuildAction.setActionDefinitionId("org.eclipse.ui.project.buildProject");
fCleanAction.setText("Clean Project");
}
结果
参考文献
- Project Explorer (2) - 给"Build Project" 添加快捷键
- Project Explorer (1) -- "Build Project" 和 "Clean Project"
- Eclipse Project Build Automatically、Build Project
- eclipse project explorer 和 package explorer 问题
- Eclipse视图:navigator、 package explorer、 project explorer
- eclipse中的navigator,package explorer,project explorer
- Eclipse Project Explorer 背景色
- Eclipse Project Build Types
- Eclipse Project Build Types
- Jenkins build Qt project
- NDK build OpenCV Project
- build keil project
- maven build web project
- ant build Project
- Maven - Build & Test Project
- android project ant build
- vue spa project build
- 给gwt项目添加了dynamic web project模块
- 我奋斗了18年,不是为了和你一起喝咖啡
- orz drj
- 深入理解http协议
- MPC相关
- 旋转菜单(很久以前借鉴的)
- Project Explorer (2) - 给"Build Project" 添加快捷键
- 编程学习(一)----开篇
- 一个简单的Canvas绘图的代码
- 三种东西永远不要放到数据库里
- 用Windows 8开发第一个Windows应用商店应用
- 常用日期SQL脚本
- HttpWebRequest的GetResponse或GetRequestStream偶尔超时 + 总结各种超时死掉的可能和相应的
- javaWev_08-用Expires头控制浏览器缓存
- 成绩处理