~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/Activator.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
 
3
 *
 
4
 * All rights reserved. This program and the accompanying materials are
 
5
 * made available under the terms of the Eclipse Public License v1.0 which
 
6
 * accompanies this distribution, and is available at
 
7
 * http://www.eclipse.org/legal/epl-v10.html
 
8
 *
 
9
 * Contributors:
 
10
 *   Francois Chouinard - Initial API and implementation
 
11
 *******************************************************************************/
 
12
 
 
13
package org.eclipse.linuxtools.internal.ctf.core;
 
14
 
 
15
import org.eclipse.core.runtime.IStatus;
 
16
import org.eclipse.core.runtime.Plugin;
 
17
import org.eclipse.core.runtime.Status;
 
18
import org.osgi.framework.BundleContext;
 
19
 
 
20
/**
 
21
 * <b><u>Activator</u></b>
 
22
 * <p>
 
23
 * The activator class controls the plug-in life cycle.
 
24
 */
 
25
public class Activator extends Plugin {
 
26
 
 
27
    // ------------------------------------------------------------------------
 
28
    // Attributes
 
29
    // ------------------------------------------------------------------------
 
30
 
 
31
    /**
 
32
     * The plug-in ID
 
33
     */
 
34
    public static final String PLUGIN_ID = "org.eclipse.linuxtools.ctf"; //$NON-NLS-1$
 
35
 
 
36
    /**
 
37
     *  The shared instance
 
38
     */
 
39
    private static Activator fPlugin;
 
40
 
 
41
    // ------------------------------------------------------------------------
 
42
    // Constructors
 
43
    // ------------------------------------------------------------------------
 
44
 
 
45
    /**
 
46
     * Constructor
 
47
     */
 
48
    public Activator() {
 
49
        setDefault(this);
 
50
    }
 
51
 
 
52
    // ------------------------------------------------------------------------
 
53
    // Accessors
 
54
    // ------------------------------------------------------------------------
 
55
 
 
56
    /**
 
57
     * Get the default activator
 
58
     * @return the default activator
 
59
     */
 
60
    public static Activator getDefault() {
 
61
        return fPlugin;
 
62
    }
 
63
 
 
64
    /**
 
65
     * Sets the default activator
 
66
     *
 
67
     * @param plugin the default activator
 
68
     */
 
69
    private static void setDefault(Activator plugin) {
 
70
        fPlugin = plugin;
 
71
    }
 
72
 
 
73
    // ------------------------------------------------------------------------
 
74
    // Plugin
 
75
    // ------------------------------------------------------------------------
 
76
 
 
77
    @Override
 
78
    public void start(BundleContext context) throws Exception {
 
79
        super.start(context);
 
80
        setDefault(this);
 
81
    }
 
82
 
 
83
    @Override
 
84
    public void stop(BundleContext context) throws Exception {
 
85
        setDefault(null);
 
86
        super.stop(context);
 
87
    }
 
88
 
 
89
    // ------------------------------------------------------------------------
 
90
    // Logging
 
91
    // ------------------------------------------------------------------------
 
92
 
 
93
    /**
 
94
     * Log a message
 
95
     * @param msg the message to log
 
96
     */
 
97
    public void log(String msg) {
 
98
        log(msg, null);
 
99
    }
 
100
 
 
101
    /**
 
102
     * Log a message with an exception
 
103
     * @param msg the message
 
104
     * @param e the exception
 
105
     */
 
106
    public void log(String msg, Exception e) {
 
107
        getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e));
 
108
    }
 
109
 
 
110
}