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.
Asked
Active
Viewed 1,098 times
2
-
1Can you elobarate more on the lifecycle of this Hashtable? The simplest thing is to create it the first time you needed, but this doesn't seem to be what you need. – Danail Nachev Jun 09 '11 at 23:05
-
I agree with Danail above. It is unlikely that you need the hashtable from the moment that Eclipse starts until the moment it shuts down. More likely, you need it for one or more of your plugins, from when they all start until they all stop. There are several mechanisms you can use to start your plugins earlier. Which one is most appropriate will depend on what exactly you want to do. – Andrew Eisenberg Jun 10 '11 at 16:38
-
My plugin downloads a file from the internet and stores it where the user indicates(path and filename). Everytime a file already downloaded is donwloaded again, plugin must suggest last path and filename used to store that same file. Already solved with a acceptable solution for me. Thank you all! – Crazy Ivan Jun 13 '11 at 13:52
2 Answers
4
You can use the extension point org.eclipse.ui.startup to start your plugin automatically with the application.

dunni
- 43,386
- 10
- 104
- 99
-
1Just a note: you can take advantage of this in core or lib plugins, but don't include this in your UI plugin. It can have serious impacts on startup performance and memory. – Paul Webster Jun 14 '11 at 15:33
3
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.");
}
}

Markus
- 809
- 5
- 10