1 | package de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation; |
2 | |
3 | import org.eclipse.core.runtime.Status; |
4 | import org.eclipse.jface.resource.ImageDescriptor; |
5 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
6 | import org.osgi.framework.BundleContext; |
7 | |
8 | /**Activator class for the R plug-in. |
9 | * The activator class controls the plug-in life cycle. |
10 | */ |
11 | public class RVisualisationPlugin extends AbstractUIPlugin { |
12 | |
13 | /** The plug-in identifier of the R visualization plug-in. */ |
14 | public static final String PLUGIN_ID = |
15 | "de.uka.ipd.sdq.sensorframework.rvisualisation"; |
16 | |
17 | /** The shared plug-in instance. */ |
18 | private static RVisualisationPlugin plugin; |
19 | |
20 | /**Default constructor. |
21 | */ |
22 | public RVisualisationPlugin() { |
23 | // Nothing to do here. |
24 | } |
25 | |
26 | /** {@inheritDoc} |
27 | */ |
28 | @Override |
29 | public void start(final BundleContext context) throws Exception { |
30 | super.start(context); |
31 | plugin = this; |
32 | } |
33 | |
34 | /** {@inheritDoc} |
35 | */ |
36 | @Override |
37 | public void stop(final BundleContext context) throws Exception { |
38 | plugin = null; |
39 | super.stop(context); |
40 | } |
41 | |
42 | /**Returns the shared plug-in instance. |
43 | * @return the shared instance |
44 | */ |
45 | public static RVisualisationPlugin getDefault() { |
46 | return plugin; |
47 | } |
48 | |
49 | /**Returns an image descriptor for the image file at the given |
50 | * plug-in relative path. |
51 | * |
52 | * @param path the path |
53 | * @return the image descriptor |
54 | */ |
55 | public static ImageDescriptor getImageDescriptor(final String path) { |
56 | return imageDescriptorFromPlugin(PLUGIN_ID, path); |
57 | } |
58 | |
59 | /**Logs a message to the Eclipse message log. |
60 | * @param severity Severity of the message. |
61 | * @param message The message itself. |
62 | */ |
63 | public static void log(final int severity, final String message) { |
64 | Status status = new Status(severity, PLUGIN_ID, message, |
65 | new Throwable()); |
66 | plugin.getLog().log(status); |
67 | plugin.getLog().log(new Status(severity, PLUGIN_ID, message)); |
68 | } |
69 | } |