View Javadoc

1   package org.seasar.eclipse.common;
2   
3   import org.eclipse.core.runtime.Plugin;
4   import org.osgi.framework.BundleContext;
5   import org.seasar.eclipse.common.util.LogUtil;
6   
7   /**
8    * The main plugin class to be used in the desktop.
9    */
10  public class CommonPlugin extends Plugin {
11  
12      // The shared instance.
13      private static CommonPlugin plugin;
14  
15      /**
16       * The constructor.
17       */
18      public CommonPlugin() {
19          plugin = this;
20      }
21  
22      /**
23       * This method is called upon plug-in activation
24       */
25      @Override
26      public void start(BundleContext context) throws Exception {
27          throw new UnsupportedOperationException("This plugin cannot started.");
28      }
29  
30      /**
31       * This method is called when the plug-in is stopped
32       */
33      @Override
34      public void stop(BundleContext context) throws Exception {
35          super.stop(context);
36          plugin = null;
37      }
38  
39      /**
40       * Returns the shared instance.
41       */
42      public static CommonPlugin getDefault() {
43          return plugin;
44      }
45  
46      public static void log(String msg) {
47          LogUtil.log(getDefault(), msg);
48      }
49  
50      public static void log(Throwable throwable) {
51          LogUtil.log(getDefault(), throwable);
52      }
53  
54  }