1
|
package eu.etaxonomy.taxeditor.store.internal;
|
2
|
|
3
|
import org.eclipse.jface.resource.ImageDescriptor;
|
4
|
import org.eclipse.jface.resource.ImageRegistry;
|
5
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
6
|
import org.osgi.framework.BundleContext;
|
7
|
|
8
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
9
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
10
|
import eu.etaxonomy.taxeditor.store.StoreStateManager;
|
11
|
|
12
|
/**
|
13
|
* The activator class controls the plug-in life cycle
|
14
|
*
|
15
|
* @author n.hoffmann
|
16
|
* @version $Id: $
|
17
|
*/
|
18
|
public class TaxeditorStorePlugin extends AbstractUIPlugin {
|
19
|
|
20
|
// The plug-in ID
|
21
|
/** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.editor"</code> */
|
22
|
public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.editor";
|
23
|
|
24
|
// The shared instance
|
25
|
private static TaxeditorStorePlugin plugin;
|
26
|
|
27
|
/**
|
28
|
* The constructor
|
29
|
*/
|
30
|
public TaxeditorStorePlugin() {
|
31
|
}
|
32
|
|
33
|
/*
|
34
|
* (non-Javadoc)
|
35
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
36
|
*/
|
37
|
/** {@inheritDoc} */
|
38
|
public void start(BundleContext context) throws Exception {
|
39
|
super.start(context);
|
40
|
|
41
|
StoreStateManager stateManager = new StoreStateManager();
|
42
|
CdmStore.getContextManager().addContextListener(stateManager);
|
43
|
|
44
|
plugin = this;
|
45
|
|
46
|
PreferencesUtil.setDefaults();
|
47
|
}
|
48
|
|
49
|
/*
|
50
|
* (non-Javadoc)
|
51
|
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
52
|
*/
|
53
|
/** {@inheritDoc} */
|
54
|
public void stop(BundleContext context) throws Exception {
|
55
|
plugin = null;
|
56
|
super.stop(context);
|
57
|
}
|
58
|
|
59
|
/**
|
60
|
* Returns the shared instance
|
61
|
*
|
62
|
* @return the shared instance
|
63
|
*/
|
64
|
public static TaxeditorStorePlugin getDefault() {
|
65
|
return plugin;
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* Returns an image descriptor for the image file at the given
|
70
|
* plug-in relative path
|
71
|
*
|
72
|
* @param path the path
|
73
|
* @return the image descriptor
|
74
|
*/
|
75
|
public static ImageDescriptor getImageDescriptor(String path) {
|
76
|
return imageDescriptorFromPlugin(PLUGIN_ID, path);
|
77
|
}
|
78
|
|
79
|
|
80
|
/**
|
81
|
* Exposes this normally protected method.
|
82
|
*
|
83
|
* @return a {@link org.eclipse.jface.resource.ImageRegistry} object.
|
84
|
*/
|
85
|
public ImageRegistry createImageRegistry(){
|
86
|
return super.createImageRegistry();
|
87
|
}
|
88
|
}
|