1 package org.eparapher.rcp;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.net.MalformedURLException;
6 import java.net.URL;
7 import java.util.PropertyResourceBundle;
8
9 import org.apache.log4j.Logger;
10 import org.eclipse.core.runtime.FileLocator;
11 import org.eclipse.core.runtime.Path;
12 import org.eclipse.core.runtime.Platform;
13 import org.eclipse.core.runtime.Status;
14 import org.eclipse.jface.resource.ImageDescriptor;
15 import org.eclipse.ui.plugin.AbstractUIPlugin;
16 import org.eparapher.rcp.tools.RCPSettings;
17 import org.osgi.framework.BundleContext;
18
19
20
21
22 public class Activator extends AbstractUIPlugin {
23
24
25 private PropertyResourceBundle properties;
26
27
28
29
30 private static Activator plugin;
31
32
33
34
35 public Activator() {
36 plugin = this;
37 }
38
39
40
41
42
43 @SuppressWarnings("deprecation")
44 public void start(BundleContext context) throws Exception {
45
46
47
48
49
50
51
52
53
54
55 super.start(context);
56 }
57
58
59
60
61
62 public void stop(BundleContext context) throws Exception {
63 plugin = null;
64 super.stop(context);
65 }
66
67
68
69
70
71
72 public static Activator getDefault() {
73 return plugin;
74 }
75
76
77
78
79
80
81
82
83 public static ImageDescriptor getImageDescriptor(String path) {
84 return imageDescriptorFromPlugin(Application.PLUGIN_ID, path);
85 }
86
87
88
89
90
91
92
93 public PropertyResourceBundle getPluginProperties()
94 {
95 if ( properties == null )
96 {
97 try
98 {
99 properties = new PropertyResourceBundle( FileLocator.openStream( this.getBundle(), new Path(
100 "plugin.properties" ), false ) );
101 }
102 catch ( IOException e )
103 {
104
105
106 getLog().log(
107 new Status( Status.ERROR, "org.eparapher.rcp", Status.OK,
108 "Unable to get the plugin properties.", e ) );
109 }
110 }
111
112 return properties;
113 }
114 }