从我的菜单调用 RCP 应用程序
我想为我的 Eclipse 创建一个插件。我打算从 Eclipse 中的应用程序菜单打开另一个 RCP 应用程序。 所以我有一个 Eclipse RCP 应用程序和一个 Eclipse 插件。该插件通过命令扩展 Eclipse 菜单以运行我的 Eclipse RCP 应用程序。
如何从菜单中调用 RCP 应用程序?
I'd like to create a plug-in for my Eclipse. I intend to open a different RCP application from the application menu in Eclipse.
So I have an Eclipse RCP application and an Eclipse plug-in. The plug-in extends the Eclipse menu by a command to run my Eclipse RCP app.
How can I call my RCP application from my menu?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您将 Eclipse 插件与 Eclipse RCP 应用程序混淆了。您到底想在这里实现什么目标?您是否开发过插件(例如 ViewPart)来扩展您的 Eclipse IDE 版本,例如针对 Java 开发人员的 Helios 3.6?
或者您是否开发了一个完整的独立 RCP 应用程序,该应用程序在启动时为您提供了一个带有空白应用程序窗口的可执行文件?
您能具体说明一下“我的菜单”是什么意思吗?您是指基于 html 的开始菜单吗?或者你的意思是普通的应用程序菜单?如果它确实是一个视图扩展插件,您可以随时从“窗口”-“显示视图”-“其他”运行它,然后选择您的视图。显然,您需要首先部署插件(eclipse 路径中的插件文件夹)。
这些有用的教程可能会帮助您解决问题:
RCP:http://www.vogella.de /articles/EclipseRCP/article.html
插件:http://www .vogella.de/articles/EclipsePlugIn/article.html
编辑:
好的,谢谢您的澄清。我想(虽然我从来没有这样做过)那么你有两个选择。由于您的 RCP 应用程序一旦构建,应该附带一个正常的运行时二进制文件,您可以使用:
( http://download.oracle.com/javase/6/docs/api/java/lang/Runtime.html )
这是运行可执行文件的标准 Java 方式。它有六个重载版本:
因此,只需选择最好的版本,例如,如果您想移交参数,则选择第四个版本。
要获取运行时实例:
您还可以自己“构建”流程:
http://www .java-tips.org/java-se-tips/java.util/from-runtime.exec-to-processbuilder.html
或使用
( http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/program/ package-summary.html )
此类最初旨在使用操作系统相关程序运行文件,例如使用默认浏览器的 HTML。但是它也可以用于运行普通的可执行文件。
为了完整起见,要从 Eclipse 中启动 Java 应用程序,您始终可以遵循本指南:
http://www.eclipse.org/articles/Article-Java -launch/launching-java.html
I think you confuse Eclipse plug-in with Eclipse RCP application. What exactly are you trying to achieve here? Have you developed a plug-in, e.g. a ViewPart to extend your version of the Eclipse IDE, for instance Helios 3.6 for Java developers?
Or have you developed a full stand-alone RCP application, which gives you an executable with a blank application window when starting it up?
Could you please specify what you mean by "my menu"? Do you mean the html based start menu? Or do you mean the normal application menu? In case it is indeed a view extension plug-in, you can always run it from "Window" - "Show View" - "Other" and then select your view. You obviously need to deploy your plug-in first (plugin folder in your eclipse path).
These useful tutorials might help you clear things up:
RCP: http://www.vogella.de/articles/EclipseRCP/article.html
Plug-in: http://www.vogella.de/articles/EclipsePlugIn/article.html
EDIT:
Okay, thank you for clearing that up. I assume (I never did that, though) you have two options then. Since your RCP app, once built, should come with a normal runtime binary, you could either use:
( http://download.oracle.com/javase/6/docs/api/java/lang/Runtime.html )
This is the standard Java way to run executables. It comes with six overloaded versions:
So just pick what's best, e.g. the fourth if you want to hand over arguments.
To obtain the Runtime instance:
You could also "build" the process yourself:
http://www.java-tips.org/java-se-tips/java.util/from-runtime.exec-to-processbuilder.html
or use
( http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/program/package-summary.html )
This class is originally intended to run files with the OS associated program, e.g. HTML with the default browser. It can however be used to run normal executables as well.
And just to be complete, to launch Java applications from within Eclipse, you can always follow this guide:
http://www.eclipse.org/articles/Article-Java-launch/launching-java.html