Checkin before attempting to databind tax. tree to "add new taxon" and propertysheet...
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor.prototype2 / src / eu / etaxonomy / taxeditor / prototype2 / Activator.java
1 package eu.etaxonomy.taxeditor.prototype2;
2
3 import org.eclipse.jface.resource.ImageDescriptor;
4 import org.eclipse.swt.graphics.Image;
5 import org.eclipse.ui.plugin.AbstractUIPlugin;
6 import org.osgi.framework.BundleContext;
7
8 import eu.etaxonomy.cdm.api.application.CdmApplicationController;
9 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
10 import eu.etaxonomy.taxeditor.prototype2.model.TaxonList;
11
12
13 /**
14 * The activator class controls the plug-in life cycle
15 */
16 public class Activator extends AbstractUIPlugin {
17
18 /**
19 * The plug-in ID
20 */
21 public static final String PLUGIN_ID = "eu.etaxonomy.mvctest";
22
23 /**
24 * The shared instance
25 */
26 private static Activator plugin;
27
28 /**
29 * The dataset of taxa for this session
30 */
31 private CdmApplicationController cdmApp = new CdmApplicationController();
32 private TaxonList taxonList = new TaxonList();
33 private TaxonList recentNamesList = new TaxonList();
34
35
36 /**
37 * The constructor
38 */
39 public Activator() {
40
41 taxonList.setTaxonList(cdmApp.getTaxonService().getRootTaxa(null));
42 }
43
44 /*
45 * (non-Javadoc)
46 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
47 */
48 public void start(BundleContext context) throws Exception {
49 super.start(context);
50 plugin = this;
51 }
52
53 /*
54 * (non-Javadoc)
55 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
56 */
57 public void stop(BundleContext context) throws Exception {
58 plugin = null;
59 super.stop(context);
60 }
61
62 /**
63 * Returns the shared instance
64 *
65 * @return the shared instance
66 */
67 public static Activator getDefault() {
68 return plugin;
69 }
70
71 /**
72 * Returns an image descriptor for the image file at the given
73 * plug-in relative path
74 *
75 * @param path the path
76 * @return the image descriptor
77 */
78 public static ImageDescriptor getImageDescriptor(String path) {
79 return imageDescriptorFromPlugin(PLUGIN_ID, path);
80 }
81
82
83 public Image getImage(String key) {
84 return getImageRegistry().get(key);
85 }
86
87 public TaxonList getTaxonList() {
88 return taxonList;
89 }
90
91 public TaxonList getRecentNamesList() {
92 return recentNamesList;
93 }
94
95 public CdmApplicationController getCdmApp() {
96 return cdmApp;
97 }
98 }