1

I try to create an eclipse plugin which deletes some files when eclipse workbench is closed. I started with the Hello, World command plugin project and added a IWorkbenchListener like mentioned in this toppic Eclipse shut down hook able to stop the termination. The listener is added when I press a special button in the eclipse menu bar (which is added by this plugin).

How can I automatically add this IWorkbenchListener, without the need of clicking on any menu entry?

asked Feb 9, 2014 at 14:16

1 Answer 1

5

Use the org.eclipse.ui.startup extension point to specify a class that implements org.eclipse.ui.IStartup. This will be called early on during Eclipse initialization.

So in the plugin.xml:

<extension
 point="org.eclipse.ui.startup">
 <startup
 class="your class implementing IStartup"/>
</extension>

Class:

public class Startup implements IStartup
{
 @Override
 public void earlyStartup()
 {
 // you action
 }
}
answered Feb 9, 2014 at 14:19
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.