| /******************************************************************************* |
| * Copyright (c) 2001, 2005 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| /* |
| |
| |
| */ |
| package org.eclipse.jem.internal.core; |
| |
| import org.eclipse.core.runtime.Plugin; |
| import org.eclipse.core.runtime.IStatus; |
| import org.eclipse.core.runtime.Status; |
| import org.eclipse.core.runtime.Platform; |
| import org.osgi.framework.BundleContext; |
| |
| import org.eclipse.jem.util.logger.proxy.Logger; |
| import org.eclipse.jem.util.logger.proxyrender.EclipseLogger; |
| |
| |
| /** |
| * org.eclipse.jem plugin |
| */ |
| public class JEMPlugin extends Plugin { |
| |
| private static JEMPlugin PLUGIN; |
| private Logger logger; |
| private static final String PLUGIN_ID = "org.eclipse.jem"; //$NON-NLS-1$ |
| |
| public JEMPlugin() { |
| PLUGIN = this; |
| } |
| |
| public static JEMPlugin getPlugin() { |
| return PLUGIN; |
| } |
| |
| |
| /* (non-Javadoc) |
| * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) |
| */ |
| public void start(BundleContext context) throws Exception { |
| super.start(context); |
| logger = EclipseLogger.getEclipseLogger(this); |
| } |
| |
| public Logger getLogger() { |
| return logger; |
| } |
| |
| public String getPluginID() { |
| return PLUGIN_ID; |
| } |
| |
| public static IStatus createStatus(int severity, String message, Throwable exception) { |
| return new Status(severity, PLUGIN_ID, severity, message, exception); |
| } |
| |
| public static void logWarning(String message, Throwable exception) { |
| Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.WARNING, message , exception)); |
| } |
| |
| public static void logError(String message, Throwable exception) { |
| Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message , exception)); |
| } |
| |
| |
| } |