Erfan Farhangy
Erfan Farhangy

Reputation: 459

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.

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.

How to achieve this?

Upvotes: 6

Views: 4750

Answers (1)

greg-449
greg-449

Reputation: 111217

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

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.

More details here

Upvotes: 12

Related Questions