blob: 61351bb63afcd529594f2070ece8b190027c6b1c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.dltk.internal.core.manipulation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.dltk.core.manipulation.ScriptManipulation;
import org.osgi.framework.BundleContext;
/**
* The main plug-in class to be used in the workbench.
*/
public class ScriptManipulationPlugin extends Plugin {
// The shared instance.
private static ScriptManipulationPlugin fgDefault;
/**
* The constructor.
*/
public ScriptManipulationPlugin() {
fgDefault = this;
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
fgDefault = null;
}
/**
* Returns the shared instance.
*
* @return the shared instance.
*/
public static ScriptManipulationPlugin getDefault() {
return fgDefault;
}
public static String getPluginId() {
return ScriptManipulation.ID_PLUGIN;
}
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
public static void logErrorMessage(String message) {
log(new Status(IStatus.ERROR, getPluginId(), IStatusConstants.INTERNAL_ERROR, message, null));
}
public static void logErrorStatus(String message, IStatus status) {
if (status == null) {
logErrorMessage(message);
return;
}
MultiStatus multi = new MultiStatus(getPluginId(), IStatusConstants.INTERNAL_ERROR, message, null);
multi.add(status);
log(multi);
}
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getPluginId(), IStatusConstants.INTERNAL_ERROR,
ScriptManipulationMessages.ScriptManipulationMessages_internalError, e));
}
}