~ubuntu-branches/ubuntu/vivid/eclipse-linuxtools/vivid-proposed

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/Activator.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2014 Ericsson
 
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
 *   Marc-Andre Laperle - Initial implementation
 
11
 *******************************************************************************/
 
12
 
 
13
package org.eclipse.linuxtools.lttng.alltests;
 
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
 * The activator class controls the plug-in life cycle. No more than one such
 
22
 * plug-in can exist at any time.
 
23
 * <p>
 
24
 * It also provides the plug-in's general logging facility and manages the
 
25
 * internal tracer.
 
26
 */
 
27
public class Activator extends Plugin {
 
28
 
 
29
    /**
 
30
     * The plug-in ID
 
31
     */
 
32
    public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng.alltests"; //$NON-NLS-1$
 
33
 
 
34
    /**
 
35
     * The shared instance
 
36
     */
 
37
    private static Activator fPlugin;
 
38
 
 
39
    /**
 
40
     * Constructor
 
41
     */
 
42
    public Activator() {
 
43
        setDefault(this);
 
44
    }
 
45
 
 
46
    // ------------------------------------------------------------------------
 
47
    // Accessors
 
48
    // ------------------------------------------------------------------------
 
49
 
 
50
    /**
 
51
     * Returns the AllTests plug-in instance.
 
52
     *
 
53
     * @return the AllTests plug-in instance.
 
54
     */
 
55
    public static Activator getDefault() {
 
56
        return fPlugin;
 
57
    }
 
58
 
 
59
    // Sets plug-in instance
 
60
    private static void setDefault(Activator plugin) {
 
61
        fPlugin = plugin;
 
62
    }
 
63
 
 
64
    // ------------------------------------------------------------------------
 
65
    // Plugin
 
66
    // ------------------------------------------------------------------------
 
67
 
 
68
    @Override
 
69
    public void start(BundleContext context) throws Exception {
 
70
        super.start(context);
 
71
        setDefault(this);
 
72
    }
 
73
 
 
74
    @Override
 
75
    public void stop(BundleContext context) throws Exception {
 
76
        setDefault(null);
 
77
        super.stop(context);
 
78
    }
 
79
 
 
80
 
 
81
    /**
 
82
     * Log an IStatus object directly
 
83
     *
 
84
     * @param status
 
85
     *            The status to log
 
86
     */
 
87
    public static void log(IStatus status) {
 
88
        fPlugin.getLog().log(status);
 
89
    }
 
90
 
 
91
    // ------------------------------------------------------------------------
 
92
    // Log INFO
 
93
    // ------------------------------------------------------------------------
 
94
 
 
95
    /**
 
96
     * Logs a message with severity INFO in the runtime log of the plug-in.
 
97
     *
 
98
     * @param message
 
99
     *            A message to log
 
100
     */
 
101
    public static void logInfo(String message) {
 
102
        fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
 
103
    }
 
104
 
 
105
    /**
 
106
     * Logs a message and exception with severity INFO in the runtime log of the
 
107
     * plug-in.
 
108
     *
 
109
     * @param message
 
110
     *            A message to log
 
111
     * @param exception
 
112
     *            The corresponding exception
 
113
     */
 
114
    public static void logInfo(String message, Throwable exception) {
 
115
        fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
 
116
    }
 
117
 
 
118
    // ------------------------------------------------------------------------
 
119
    // Log WARNING
 
120
    // ------------------------------------------------------------------------
 
121
 
 
122
    /**
 
123
     * Logs a message and exception with severity WARNING in the runtime log of
 
124
     * the plug-in.
 
125
     *
 
126
     * @param message
 
127
     *            A message to log
 
128
     */
 
129
    public static void logWarning(String message) {
 
130
        fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
 
131
    }
 
132
 
 
133
    /**
 
134
     * Logs a message and exception with severity WARNING in the runtime log of
 
135
     * the plug-in.
 
136
     *
 
137
     * @param message
 
138
     *            A message to log
 
139
     * @param exception
 
140
     *            The corresponding exception
 
141
     */
 
142
    public static void logWarning(String message, Throwable exception) {
 
143
        fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
 
144
    }
 
145
 
 
146
    // ------------------------------------------------------------------------
 
147
    // Log ERROR
 
148
    // ------------------------------------------------------------------------
 
149
 
 
150
    /**
 
151
     * Logs a message and exception with severity ERROR in the runtime log of
 
152
     * the plug-in.
 
153
     *
 
154
     * @param message
 
155
     *            A message to log
 
156
     */
 
157
    public static void logError(String message) {
 
158
        fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
 
159
    }
 
160
 
 
161
    /**
 
162
     * Logs a message and exception with severity ERROR in the runtime log of
 
163
     * the plug-in.
 
164
     *
 
165
     * @param message
 
166
     *            A message to log
 
167
     * @param exception
 
168
     *            The corresponding exception
 
169
     */
 
170
    public static void logError(String message, Throwable exception) {
 
171
        fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
 
172
    }
 
173
}