首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

eclipse下令框架(一)

2012-06-27 
eclipse命令框架(一)在eclipse中有两种方式添加菜单,上下文菜单,工具栏等,一种是IAction,另一种是command。

eclipse命令框架(一)


在eclipse中有两种方式添加菜单,上下文菜单,工具栏等,一种是IAction,另一种是command。犹豫IAction实现的时候UI跟业务是耦合在一起的,所以eclipse才推出command。

?

1.命令框架类图体系结构的概述:

?

eclipse下令框架(一)

?

?

?

2.创建一个简单完整的命令:

?

(1)扩展org.eclipse.ui.commands,此扩展点只是定义command而不实现其业务逻辑

?

?

ICommandService cmdService = (ICommandService) getSite().getService(    ICommandService.class);Category lunch = cmdService    .getCategory("z.ex.view.keybindings.category");if (!lunch.isDefined()) {  lunch.define("Lunch", "Actions take at lunch time.");}Command eatTaco = cmdService    .getCommand("z.ex.view.keybindings.eatTaco");if (!eatTaco.isDefined()) {  eatTaco.define("Eat That Taco", "Go for the taco.", lunch);}
?

?

热点排行