trace/tracebuilder/com.nokia.tracebuilder.eventhandler/src/com/nokia/tracebuilder/eventhandler/Activator.java
changeset 10 ed1c9f64298a
equal deleted inserted replaced
9:14dc2103a631 10:ed1c9f64298a
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 * The activator class controls the plug-in life cycle
       
    17 *
       
    18 */
       
    19 package com.nokia.tracebuilder.eventhandler;
       
    20 
       
    21 import org.eclipse.core.runtime.Plugin;
       
    22 import org.osgi.framework.BundleContext;
       
    23 
       
    24 /**
       
    25  * The activator class controls the plug-in life cycle
       
    26  */
       
    27 public class Activator extends Plugin {
       
    28 
       
    29 	/**
       
    30 	 * The plug-in ID
       
    31 	 */
       
    32 	public static final String PLUGIN_ID = "com.nokia.tracebuilder.eventhandler"; //$NON-NLS-1$
       
    33 
       
    34 	/**
       
    35 	 * The shared instance
       
    36 	 */
       
    37 	private static Activator plugin;
       
    38 
       
    39 	/**
       
    40 	 * Event handler
       
    41 	 */
       
    42 	TraceBuilderEventHandler handler;
       
    43 
       
    44 	/**
       
    45 	 * The constructor
       
    46 	 */
       
    47 	public Activator() {
       
    48 		plugin = this;
       
    49 	}
       
    50 
       
    51 	/*
       
    52 	 * (non-Javadoc)
       
    53 	 * 
       
    54 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
       
    55 	 */
       
    56 	@Override
       
    57 	public void start(BundleContext context) throws Exception {
       
    58 		handler = new TraceBuilderEventHandler();
       
    59 		super.start(context);
       
    60 	}
       
    61 
       
    62 	/*
       
    63 	 * (non-Javadoc)
       
    64 	 * 
       
    65 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
       
    66 	 */
       
    67 	@Override
       
    68 	public void stop(BundleContext context) throws Exception {
       
    69 		plugin = null;
       
    70 		if (handler != null) {
       
    71 			handler.shutdown();
       
    72 		}
       
    73 		super.stop(context);
       
    74 	}
       
    75 
       
    76 	/**
       
    77 	 * Returns the shared instance
       
    78 	 * 
       
    79 	 * @return the shared instance
       
    80 	 */
       
    81 	public static Activator getDefault() {
       
    82 		return plugin;
       
    83 	}
       
    84 
       
    85 }