激活激活器类
我使用的是eclipse 3.6。我创建了一个示例插件应用程序。它既不是 eclipse rcp,也不是工作台。现在,当我运行 eclipse 时,我希望也加载该插件。但我不想使用 IStartUp。因为我发现的是 IStartup 将在工作台加载后被调用。我想刷新一些菜单。那么有什么方法可以在 Eclipse 加载时激活我的插件吗? 我尝试使用捆绑激活策略。但这也没有激活我的 Activator 类。我只是放了一个System.out。 println("start() 内部").所以这不叫。现在我可以让它激活我的激活器吗?
编辑:
我的确切要求是什么,我创建了一个工作台应用程序。它不是 eclipse rcp 应用程序。现在我想在加载 eclipe 之前从 eclipse 中删除以下菜单和菜单项。 1. 文件菜单 2.) 搜索菜单 3.)运行菜单 4.)帮助->搜索、动态帮助、按键辅助、提示和技巧、报告错误、备忘单。
这些菜单是eclipse的内置菜单。所以这就是我必须这样做的原因。
所以我已经通过使用启动扩展点来实现。但是早期启动是在 eclipse 启动后调用的。所以我需要在工作台上做一些刷新。然后只有菜单项会被删除。所以我认为我需要启动扩展点不会满足我的要求,因为它不会刷新工作台。我需要在加载之前激活我的插件并刷新工作台。
谢谢 巴努
I am using eclipse 3.6. I created one sample plugin application. It is neither a eclipse rcp nor workbench. Now when I run the eclipse I want that plugin also to be loaded. But I dont want to use IStartUp. Because what I have found out is
IStartup will be called after the workbench is loaded. I want to refresh some menu. So Is there any way to activate my plugin while the eclipse loaded?
I tried to use Bundle Activation policy. But that is also not activating my Activator class. I just put one System.out. println("Inside start()"). So that is not called. Now can I make it activate my activator?
EDIT:
what my exact requirement is, I have created one workbench application.It is not eclipse rcp application. Now I want to remove the following menu and menu items from the eclipse before the eclipe is loaded.
1. File Menu
2.) Search Menu
3.)Run Menu
4.)Help->search,Dynamic Help,Key assist,Tips and trick,Report Bug,Cheat Sheet.
These menus are inbuilt menu of eclipse. So that is the reason I have to do in this way.
So I already implemented by using startup extension point. But the early startup is called after the eclipse is started.So I need to do some refreshment on the workbench.Then only the menu item will get removed.So I thought I need startup extension point will not satisfy my requirement as it doesnot refresh the workbench.I need to activate the my plugin and refresh the workbench before it is loaded.
Thanks
Bhanu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为您的插件设置所需的启动级别使用触摸点指令。
You can set the needed start level for your plugin using touch point instruction.
你只是一个期望在 Eclipse IDE 中运行的插件?
那么答案是,你不能做你想做的事。
如果在工作台初始化完成之前启动,大多数可以使用的服务将无法工作:工作台本身、菜单服务、命令服务等。
对于 Eclipse 中的大多数插件,plugin.xml 应该用于向 Eclipse 添加菜单、视图、编辑器等。必要时,框架将实例化它们。
org.eclipse.ui.IStartup 可用,正如您所提到的,它将在工作台初始化之后、显示任何窗口之前调用。它不能轻易使用,也不能被贡献于 UI 的插件使用,因为它允许加载该插件的所有扩展。
编辑:
如果您是RCP应用,则您可以控制主菜单。作为 RCP 应用程序,您可以访问
ActionBarAdvisor
、WorkbenchAdvisor
、WorkbenchWindowAdvisor
,它们都具有生命周期方法。如果您是一个 eclipse 插件,您可以添加到主菜单...您无法轻松地从主菜单中删除。这是设计使然。启动级别和org.eclipse.ui.startup是两种不会执行您想要的操作的机制。
您仍需要回答以下问题:
也许还有办法。你问题的关键是:“我想刷新一些菜单”
菜单项的复合列表
菜单等)?
请编辑您的问题(请勿发表评论)并包含上述 3 个问题中的信息。
You are just a plugin that expects to run in the Eclipse IDE?
Then the answer is, you cannot do what you want.
If you start before the workbench has finished initializing, most of the services that could be used won't work: The workbench itself, menu service, command service, etc.
For most plugins in eclipse, the plugin.xml should be used to add menus, views, editors, etc to eclipse. When necessary, the framework will instantiate them.
org.eclipse.ui.IStartup
is available and as you mentioned it will be called after the workbench has been initialized, but before any windows have been shown. It's not to be used lightly, and not by plugins contributing to the UI as it allows all extension from that plugin to be loaded.EDIT:
If you are an RCP app, you control the main menu. As an RCP app, you have access to the
ActionBarAdvisor
,WorkbenchAdvisor
,WorkbenchWindowAdvisor
, which all have lifecycle methods.If you are an an eclipse plugin, you can add to the main menu ... you cannot easily remove from the main menu. This is by design. Start levels and org.eclipse.ui.startup are 2 mechanisms that won't do what you want.
You still need to answer these questions:
There might still be a way. The crux of your problem is: "I want to refresh some menu"
compound list of menu items in a
menu, etc)?
Please edit your question (do not comment) and include the information from the above 3 questions, please.