01: package nz.ac.massey.take.takeep;
02:
03: import java.io.PrintWriter;
04: import java.io.Writer;
05:
06: import nz.ac.massey.take.takeep.actionsSets.wizards.TakeCompilerWizard;
07:
08: import org.apache.log4j.Appender;
09: import org.apache.log4j.BasicConfigurator;
10: import org.apache.log4j.ConsoleAppender;
11: import org.apache.log4j.Logger;
12: import org.apache.log4j.PatternLayout;
13: import org.apache.log4j.WriterAppender;
14: import org.eclipse.ui.console.MessageConsole;
15: import org.eclipse.ui.plugin.AbstractUIPlugin;
16: import org.osgi.framework.BundleContext;
17:
18: /**
19: * The activator class controls the plug-in life cycle
20: */
21: public class Activator extends AbstractUIPlugin {
22:
23: // The plug-in ID
24: public static final String PLUGIN_ID = "TakeEP";
25:
26: // The shared instance
27: private static Activator plugin;
28:
29: /**
30: * The constructor
31: */
32: public Activator() {
33: }
34:
35: /*
36: * (non-Javadoc)
37: *
38: * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
39: */
40: @Override
41: public void start(BundleContext context) throws Exception {
42: super .start(context);
43:
44: MessageConsole mc = TakeCompilerWizard.findConsole("Take Log");
45: WriterAppender ac = new WriterAppender(new PatternLayout(),
46: new PrintWriter(mc.newMessageStream()));
47: BasicConfigurator.configure(ac);
48:
49: plugin = this ;
50: }
51:
52: /*
53: * (non-Javadoc)
54: *
55: * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
56: */
57: @Override
58: public void stop(BundleContext context) throws Exception {
59: plugin = null;
60: super .stop(context);
61: }
62:
63: /**
64: * Returns the shared instance
65: *
66: * @return the shared instance
67: */
68: public static Activator getDefault() {
69: return plugin;
70: }
71:
72: }
|