Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / TmfCorePlugin.java
index be83eb4a7f89b6b591b6c580a91063234e91ece9..949ac5b3300325119b8435496ef39c852cf01d21 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 Ericsson
+ * Copyright (c) 2009, 2010, 2011 Ericsson
  * 
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
 package org.eclipse.linuxtools.tmf;
 
 import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
 
 /**
  * <b><u>TmfCorePlugin</u></b>
  * <p>
- * The activator class controls the plug-in life cycle
+ * The activator class controls the plug-in life cycle. No more than one such
+ * plug-in can exist at any time.
  */
 public class TmfCorePlugin extends Plugin {
 
-    // ========================================================================
+       // ------------------------------------------------------------------------
     // Attributes
-    // ========================================================================
+       // ------------------------------------------------------------------------
 
        // The plug-in ID
-       public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf";
+       public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf"; //$NON-NLS-1$
 
        // The shared instance
-       private static TmfCorePlugin plugin;
+       private static TmfCorePlugin fPlugin;
        
-    // ========================================================================
+       // ------------------------------------------------------------------------
     // Constructors
-    // ========================================================================
+       // ------------------------------------------------------------------------
 
-       /**
-        * The constructor
-        */
        public TmfCorePlugin() {
-               plugin = this;
+               setDefault(this);
        }
 
-    // ========================================================================
+       // ------------------------------------------------------------------------
     // Accessors
-    // ========================================================================
+       // ------------------------------------------------------------------------
 
-    /**
-     * @return the shared instance
-     */
     public static TmfCorePlugin getDefault() {
-        return plugin;
+        return fPlugin;
     }
 
+       private static void setDefault(TmfCorePlugin plugin) {
+               fPlugin = plugin;
+       }
+
+       // ------------------------------------------------------------------------
+    // Plugin
+       // ------------------------------------------------------------------------
+
+       @Override
+       public void start(BundleContext context) throws Exception {
+               super.start(context);
+               setDefault(this);
+               Tracer.init();
+       }
+
+       @Override
+       public void stop(BundleContext context) throws Exception {
+               Tracer.stop();
+               setDefault(null);
+               super.stop(context);
+       }
+
 }
This page took 0.024589 seconds and 5 git commands to generate.