Eclipse life cycle

1.1k Views Asked by At

I'm developing an Eclipse Plug-in. I have Activator class and my own classes. I need an Hashtable that must be initiated when the IDE is loaded and must be kept and accessible (used through several classes) until the IDE is closed.

2

There are 2 best solutions below

0
On

Create a separate plugin to hold the Hashtable, and have it extend org.eclipse.ui.startup,

A simple example:

plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.startup">
      <startup
            class="org.markus.startup.EarlyGreeter">
      </startup>
   </extension>
</plugin>

EarlyGreeter.java:

package org.markus.startup;

import org.eclipse.ui.IStartup;

public class EarlyGreeter implements IStartup {
    @Override
    public void earlyStartup() {
        System.out.println("This is EarlyGreeter saying Hello during workbench startup.");
    }
}
1
On

You can use the extension point org.eclipse.ui.startup to start your plugin automatically with the application.