开发者

Eclipse life cycle

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


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


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.");
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜