blob: 425404b93ec2e48b02ed75bccdc04238fdae91b4 [file] [log] [blame]
package org.eclipse.ptp.services.core;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
/**
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
* part of a work in progress. There is no guarantee that this API will work or
* that it will remain the same. Please do not use this API without consulting
* with the RDT team.
*
* The activator class controls the plug-in life cycle
*/
public class Activator extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.ptp.services.core"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
// If the plugin fails to activate because of an exception in the ServiceModelManager
// then we need to know what happened, so log it.
try {
ServiceModelManager.getInstance().loadModelConfiguration();
} catch(Exception e) {
log(e);
}
ProjectDeletionListener.startListening();
}
@Override
public void stop(BundleContext context) throws Exception {
try {
ProjectDeletionListener.stopListening();
}
finally {
plugin = null;
super.stop(context);
}
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
public void log(Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
}
public void log(IStatus status) {
getLog().log(status);
}
public void logErrorMessage(String message) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, null));
}
}