Commit | Line | Data |
---|---|---|
1474c201 FG |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 École Polytechnique de Montréal | |
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 | ||
10 | package org.eclipse.tracecompass.internal.analysis.graph.ui; | |
11 | ||
12 | import org.eclipse.core.runtime.IStatus; | |
13 | import org.eclipse.core.runtime.Status; | |
14 | import org.eclipse.ui.plugin.AbstractUIPlugin; | |
15 | import org.osgi.framework.BundleContext; | |
16 | ||
17 | /** | |
18 | * The activator class controls the plug-in life cycle | |
19 | * | |
20 | * @author Geneviève Bastien | |
21 | */ | |
22 | public class Activator extends AbstractUIPlugin { | |
23 | ||
24 | /** The plug-in ID */ | |
25 | public static final String PLUGIN_ID = "org.eclipse.tracecompass.analysis.graph.ui"; //$NON-NLS-1$ | |
26 | ||
27 | // The shared instance | |
28 | private static Activator plugin; | |
29 | ||
30 | /** | |
31 | * The constructor | |
32 | */ | |
33 | public Activator() { | |
34 | } | |
35 | ||
36 | @Override | |
37 | public void start(BundleContext context) throws Exception { | |
38 | super.start(context); | |
39 | plugin = this; | |
40 | } | |
41 | ||
42 | @Override | |
43 | public void stop(BundleContext context) throws Exception { | |
44 | plugin = null; | |
45 | super.stop(context); | |
46 | } | |
47 | ||
48 | /** | |
49 | * Returns the shared instance | |
50 | * | |
51 | * @return the shared instance | |
52 | */ | |
53 | public static Activator getDefault() { | |
54 | return plugin; | |
55 | } | |
56 | ||
57 | // -------------------------------------- | |
58 | // Log functions | |
59 | // -------------------------------------- | |
60 | ||
61 | /** | |
62 | * Logs a message with severity INFO in the runtime log of the plug-in. | |
63 | * | |
64 | * @param message | |
65 | * A message to log | |
66 | */ | |
67 | public void logInfo(String message) { | |
68 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message)); | |
69 | } | |
70 | ||
71 | /** | |
72 | * Logs a message and exception with severity INFO in the runtime log of the | |
73 | * plug-in. | |
74 | * | |
75 | * @param message | |
76 | * A message to log | |
77 | * @param exception | |
78 | * A exception to log | |
79 | */ | |
80 | public void logInfo(String message, Throwable exception) { | |
81 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception)); | |
82 | } | |
83 | ||
84 | /** | |
85 | * Logs a message and exception with severity WARNING in the runtime log of | |
86 | * the plug-in. | |
87 | * | |
88 | * @param message | |
89 | * A message to log | |
90 | */ | |
91 | public void logWarning(String message) { | |
92 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message)); | |
93 | } | |
94 | ||
95 | /** | |
96 | * Logs a message and exception with severity WARNING in the runtime log of | |
97 | * the plug-in. | |
98 | * | |
99 | * @param message | |
100 | * A message to log | |
101 | * @param exception | |
102 | * A exception to log | |
103 | */ | |
104 | public void logWarning(String message, Throwable exception) { | |
105 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception)); | |
106 | } | |
107 | ||
108 | /** | |
109 | * Logs a message and exception with severity ERROR in the runtime log of | |
110 | * the plug-in. | |
111 | * | |
112 | * @param message | |
113 | * A message to log | |
114 | */ | |
115 | public void logError(String message) { | |
116 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message)); | |
117 | } | |
118 | ||
119 | /** | |
120 | * Logs a message and exception with severity ERROR in the runtime log of | |
121 | * the plug-in. | |
122 | * | |
123 | * @param message | |
124 | * A message to log | |
125 | * @param exception | |
126 | * A exception to log | |
127 | */ | |
128 | public void logError(String message, Throwable exception) { | |
129 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception)); | |
130 | } | |
131 | ||
132 | } |