blob: 75f6ff7c8c14bf59c1b38dc45f4b477efbf8463a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2010 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.ptp.remote.rse.core;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.ptp.remote.rse.core.messages.Messages;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class RSEAdapterCorePlugin extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.ptp.remote.rse.core"; //$NON-NLS-1$
// The shared instance
private static RSEAdapterCorePlugin plugin;
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static RSEAdapterCorePlugin getDefault() {
return plugin;
}
/**
* Create log entry from an IStatus
*
* @param status
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
/**
* Create log entry from a string
*
* @param msg
*/
public static void log(String msg) {
log(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR, msg, null));
}
/**
* Create log entry from a Throwable
*
* @param e
*/
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR, Messages.Activator_0, e));
}
/**
* The constructor
*/
public RSEAdapterCorePlugin() {
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* @since 4.0
*/
public static void log(String message, Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, e));
}
/**
* @since 4.0
*/
public void logErrorMessage(String message) {
log(new Status(IStatus.ERROR, getPluginId(), message, null));
}
/**
* @since 4.0
*/
public static String getPluginId() {
return PLUGIN_ID;
}
}