如何在启动时自动在Eclipse中运行插件代码? [英] How to run plugin code in Eclipse automatically on startup?

查看:191
本文介绍了如何在启动时自动在Eclipse中运行插件代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个在用户打开Eclipse IDE时自动在后台运行的Eclipse插件。

I want to create an Eclipse plugin that automatically runs in the background, as soon as the user opens the Eclipse IDE.

例如,我正在构建Java。 Eclipse插件可以获取当前的活动文件地址,但是我希望该插件始终在后台运行,而无需用户手动运行它。

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.

如何实现?

推荐答案

org.eclipse.ui.startup 扩展点使您可以定义在工作台初始化期间较早运行的类。

The org.eclipse.ui.startup extension point lets you define a class that is run early during workbench initialization.

扩展点如下所示:

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

指定的类必须实现 org.eclipse.ui.IStartup 界面。

the class specified must implement the org.eclipse.ui.IStartup interface.

更多详细信息此处

这篇关于如何在启动时自动在Eclipse中运行插件代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆