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