/******************************************************************************* * Copyright (c) 2003, 2006 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.jst.servlet.ui.internal.plugin; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.core.runtime.Platform; import java.lang.Throwable; import org.eclipse.core.runtime.CoreException; /** * @author jlanuti * */ public class ServletUIPlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "org.eclipse.jst.servlet.ui"; //$NON-NLS-1$ // The shared instance. private static ServletUIPlugin plugin; /** * The constructor. */ public ServletUIPlugin() { super(); plugin = this; } /** * Returns the shared instance. */ public static ServletUIPlugin getDefault() { return plugin; } /** * Returns the workspace instance. */ public static IWorkspace getWorkspace() { return ResourcesPlugin.getWorkspace(); } public static void log( final Exception e ) { final String msg = e.getMessage() + ""; //$NON-NLS-1$ log( new Status( IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e ) ); } public static void log( final IStatus status ) { getDefault().getLog().log( status ); } public static IStatus createStatus(int severity, String message, Throwable exception) { return new Status(severity, PLUGIN_ID, message, exception); } public static IStatus createStatus(int severity, String message) { return createStatus(severity, message, null); } public static void logError(Throwable exception) { Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception)); } public static void logError(CoreException exception) { Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() ); } }