Show LoggingPlugin.java syntax highlighted
package com.tools.logging;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
import java.util.*;
public class LoggingPlugin extends Plugin {
private static LoggingPlugin plugin;
private ArrayList logManagers = new ArrayList();
public LoggingPlugin() {
super();
plugin = this;
}
public static LoggingPlugin getDefault() {
return plugin;
}
/**
* Iterates over the list of active log managers and shutdowns each one
* before calling the base class implementation.
* @see Plugin#stop
*/
public void stop(BundleContext context) throws Exception {
synchronized (this.logManagers) {
Iterator it = this.logManagers.iterator();
while (it.hasNext()) {
PluginLogManager logManager = (PluginLogManager) it.next();
logManager.internalShutdown();
}
this.logManagers.clear();
}
super.stop(context);
}
/**
* Adds a log manager object to the list of active log managers
*/
void addLogManager(PluginLogManager logManager) {
synchronized (this.logManagers) {
if (logManager != null)
this.logManagers.add(logManager);
}
}
/**
* Removes a log manager object from the list of active log managers
*/
void removeLogManager(PluginLogManager logManager) {
synchronized (this.logManagers) {
if (logManager != null)
this.logManagers.remove(logManager);
}
}
}
See more files for this project here