简体   繁体   English

如何在启动时自动在 Eclipse 中运行插件代码?

[英]How to run plugin code in Eclipse automatically on startup?

I want to create an Eclipse plugin that automatically runs in the background, as soon as the user opens the Eclipse IDE.我想创建一个自动在后台运行的 Eclipse 插件,只要用户打开 Eclipse IDE。

For example, I am building a Java Eclipse plugin that gets the current active file address, but I would like this plugin to always run in the background without user having to run it manually.例如,我正在构建一个获取当前活动文件地址的 Java Eclipse 插件,但我希望这个插件始终在后台运行,而无需用户手动运行。

How to achieve this?如何实现这一目标?

The org.eclipse.ui.startup extension point lets you define a class that is run early during workbench initialization. org.eclipse.ui.startup扩展点允许您定义一个在工作台初始化期间提前运行的类。

The extension point looks something like:扩展点看起来像:

<extension point="org.eclipse.ui.startup">
   <startup class="package.StartupClass"/>
</extension>

the class specified must implement the org.eclipse.ui.IStartup interface.指定的类必须实现org.eclipse.ui.IStartup接口。

More details here更多细节在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM