android - Eclipse 插件 : What is the difference between action bars vs. 菜单、工具栏...?

标签 android menu eclipse-plugin android-actionbar eclipse-pde

问题:关于 Eclipse 插件开发,在添加操作(特别是添加到 Java 编辑器)时,操作栏与菜单、工具栏...之间有什么区别?

我想在 Eclipse 中向 Java 编辑器添加操作。我正在对 org.eclipse.jdt.ui 中的“更改方法签名”操作之后的操作进行建模。起初,我以为我会简单地做通常的 org.eclipse.ui.menus添加一个菜单项,这足以满足我的目的。看完org.eclipse.jdt.ui.actions.RefactorActionGroup ,我看到 RefactorActionGroup 类强调将操作放在操作栏中的方法

public void fillActionBars(IActionBars)

我发现关于这个主题的唯一讨论是在 2006 article 中引用 Eclipse 3.1:

In Eclipse jargon, "action bar" is a catch-all term for menus, toolbars, and status bars. The ActionBar Advisor handles creating Actions within these locations. A plug-in can also contribute actions dynamically with its plugin.xml file. See Listing 7 for the implementation provided by the plug-in wizard and Table 7 for the methods.

虽然我很困惑。如果您要在任何情况下显式地将操作添加为菜单,为什么像 org.eclipse.jdt.ui.actions.RefactorActionGroup 这样的代码示例会处理操作栏? Action Bars和其他添加 Action 的方式有什么关系....

谢谢。

最佳答案

RefactorActionGroup 是遗留类(自 2.0 以来),org.eclipse.ui.menus很晚才添加。您应该坚持使用 menus 扩展点。

操作组的用法是直接的——每个编辑器都知道它需要哪些操作,并要求相应的操作组来创建这些操作。而通过 org.eclipse.ui.menus 扩展点的命令和菜单贡献是动态的——原始编辑器/ View 不需要知道任何关于添加的内容。

关于android - Eclipse 插件 : What is the difference between action bars vs. 菜单、工具栏...?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8872678/

相关文章:

javascript - jQuery 菜单 - 在下拉悬停时保持菜单处于事件状态

maven - 使用 Eclipse 时项目导入错误

android - 为什么这个由 facebook 生成的深层链接 (applink) 不起作用?

android - ListView 的项目没有显示

android - 从 android fragment 访问 MyApplication

wordpress - 将缩略图添加到二级 wordpress 导航菜单

android - 如何在 Android 的完整应用程序中使用菜单

android - 使用 eclipse 在 Android 中快速构建

java - 如何实现ContentProvider的getParent方法

android - 在android中的类中的对话框 fragment 的线性布局中添加textview