3.x RC1 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / PHPDebugCorePlugin.java
1 package net.sourceforge.phpdt.internal.debug.core;
2
3 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
4 import org.eclipse.core.resources.IWorkspace;
5 import org.eclipse.core.runtime.IPluginDescriptor;
6 import org.eclipse.core.runtime.IStatus;
7 import org.eclipse.core.runtime.Plugin;
8 import org.eclipse.core.runtime.Status;
9 import org.eclipse.core.runtime.*;
10 import org.osgi.framework.BundleContext;
11
12 /**
13  * The main plugin class to be used in the desktop.
14  */
15 public class PHPDebugCorePlugin extends Plugin {
16         public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$
17         //      The shared instance.
18         protected static PHPDebugCorePlugin plugin;
19
20         /**
21          * The constructor.
22          */
23         public PHPDebugCorePlugin(IPluginDescriptor descriptor) {
24                 super(descriptor);
25                 plugin = this;
26         } 
27
28         /**
29          * Returns the shared instance.
30          */
31         public static PHPDebugCorePlugin getDefault() {
32                 return plugin;
33         }
34
35         /**
36          * Returns the workspace instance.
37          */
38         public static IWorkspace getWorkspace() {
39                 return PHPeclipsePlugin.getWorkspace();
40         }
41         
42         public static void log(int severity, String message) {
43                 Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
44                 PHPDebugCorePlugin.log(status) ;
45         }
46
47         public static void log(IStatus status) {
48                 getDefault().getLog().log(status);
49         }
50
51         public static void log(Throwable e) {
52                 log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
53         }
54
55         /**
56          * Convenience method which returns the unique identifier of this plugin.
57          */
58 //      public static String getUniqueIdentifier() {
59 //              if (getDefault() == null) {
60 //                      // If the default instance is not yet initialized,
61 //                      // return a static identifier. This identifier must
62 //                      // match the plugin id defined in plugin.xml
63 //                      return PLUGIN_ID;
64 //              }
65 //              return getDefault().getDescriptor().getUniqueIdentifier();
66 //      }
67         
68         /**
69          * @see Plugin#shutdown()
70          */
71         public void shutdown() throws CoreException {
72                 plugin = null;
73                 super.shutdown();
74         }
75         /**
76          * This method is called upon plug-in activation
77          */
78         public void start(BundleContext context) throws Exception {
79                 super.start(context);
80         }
81
82         /**
83          * This method is called when the plug-in is stopped
84          */
85         public void stop(BundleContext context) throws Exception {
86                 super.stop(context);
87         }
88 }