修复 Eclipse 插件中消失的 LaunchShortcut
我正在开发一个 eclipse 插件,用于为另一个 java 平台创建插件。
我已经设法弄清楚 LaunchShortcut 概念、LaunchDelegate 等。插件的基本代码路径:
- 如果检测到右键单击的项目是“插件”项目,我会显示一个 launchShortcut 显示。
- 这是通过 propertyTester 检测到的。
- 一旦成功,我的启动快捷方式就会运行,它会找到现有的启动配置,或者创建一个新的启动配置(如果以前不存在)。
- 然后通过 DebugUITools.launch(...) 启动此启动配置,
- 从而运行我的 LaunchDelegate,它设置 VMRunnerConfiguration 以启动要加载插件的“应用程序”。这一切都完成了,这样我们就可以轻松地使用 Eclipse 中的调试器针对启动的应用程序来测试插件。
到目前为止,世界都是幸福美好的。您可以通过右键单击项目、转到运行/调试、启动插件来一遍又一遍地执行此操作。
但是,当您第二次单击 Eclipse 菜单栏中的下拉菜单进行运行或调试时(您知道之前运行的应用程序列表),从此时起,右键单击项目将不再起作用。
PropertyTester 甚至没有被调用。深入研究 LaunchConfigurationManager
显示我的 launchShortcut 不再存在,这特别奇怪,因为快捷方式列表仅加载一次。
无论如何,我完全不知道 Eclipse 在这里做什么以及我需要做什么才能让事情再次变得愉快。
任何建议/帮助将不胜感激。谢谢。
I'm developing an eclipse plugin for creating a plugin for another java platform.
I've managed to figure out the LaunchShortcut concept, LaunchDelegate, etc. The basic codepath of the plugin:
- I have a launchShortcut display if it detects the project right clicked is a "plugin" project.
- This is detected via a propertyTester
- Once successful, my launch shortcut runs, which finds an existing launch configuration, or creates a new one if non previously existed.
- This launch configuration is then launched via
DebugUITools.launch(...)
- My LaunchDelegate is thus run, which sets up VMRunnerConfiguration for launching the "application" the plugin is to be loaded with. This is all done so we can easily use the debugger in eclipse against the launched application to test the plugin.
Up until this point, the world is happy and well. You can do this over and over and over again by right click project, go to run/debug, launch the plugin.
However, the SECOND you click the drop down in the Eclipse menu bar for run or debug (you know the list of apps previously run), from this point forward the right click on project no longer works.
The PropertyTester is not even invoked. Digging deep into the LaunchConfigurationManager
shows that some how my launchShortcut no longer exists, which is especially strange since the list of shortcuts is only loaded once.
Anyways, I'm at a COMPLETE loss as to what Eclipse is doing here and what I need to do in order to make things happy again.
Any advice/help would be greatly appreciated. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些以后可能遇到这个问题的人。
显然,您的 PropertyTester 需要能够测试 java.lang.Object。如果您不这样做并且尝试测试类似 IJavaProject 的内容,则您的插件将在运行下拉列表悬停期间失败,因为它将无法在某些对象上使用您的属性测试器(废话)。
不正常的是,当发生这种情况时,您的快捷方式将从所有可能使用的地方删除。
For those of you who may hit this problem later.
Apparently, your PropertyTester needs to be able to test java.lang.Object. If you do not do this and you try to test something like IJavaProject, your plugin will fail during the hover of the run drop down as it will not be able to use your property tester on certain objects (duh).
Whats not duh is when this happens, that your shortcut is removed from all possible places it can be used.