/**************************************************************************** * * Copyright (c) 2011, EBM WebSourcing * * This source code is available under agreement available at * http://www.petalslink.com/legal/licenses/petals-studio * * You should have received a copy of the agreement along with this program. * If not, write to EBM WebSourcing (4, rue Amelie - 31200 Toulouse, France). * *****************************************************************************/ package org.eclipse.bpel.common.wsdl; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; /** * The activator class controls the plug-in life cycle * @author Vincent Zurczak - EBM WebSourcing */ public class SoaWsdlCommonPlugin extends AbstractUIPlugin { // The plug-in ID public static final String PLUGIN_ID = "org.eclipse.bpel.common.wsdl"; //$NON-NLS-1$ // The shared instance private static SoaWsdlCommonPlugin plugin; /** * The constructor */ public SoaWsdlCommonPlugin() { // nothing } /* * (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); } /** * Returns the shared instance * @return the shared instance */ public static SoaWsdlCommonPlugin getDefault() { return plugin; } /** * Logs an exception. * @param e the exception to log * @param severity the severity, given as one of the {@link IStatus} constants */ public static void log( Exception e, int severity ) { String msg = e.getMessage(); if( msg == null || msg.trim().length() == 0 ) msg = "An error occurred."; IStatus status = new Status( severity, PLUGIN_ID, msg, e ); getDefault().getLog().log( status ); } /** * Logs a message. * @param message the message to log * @param severity the severity, given as one of the {@link IStatus} constants */ public static void log( String message, int severity ) { IStatus status = new Status( severity, PLUGIN_ID, message ); getDefault().getLog().log( status ); } /** * Logs a message and an exception. * @param e the exception to log * @param severity the severity, given as one of the {@link IStatus} constants * @param message the message to log */ public static void log( Exception e, int severity, String message ) { IStatus status = new Status( severity, PLUGIN_ID, message, e ); getDefault().getLog().log( status ); } }