1
2
3
4
5
6
7 package pl.edu.agh.cast.schema;
8
9 import org.apache.log4j.ConsoleAppender;
10 import org.apache.log4j.Logger;
11 import org.apache.log4j.PatternLayout;
12 import org.eclipse.core.runtime.Plugin;
13 import org.osgi.framework.BundleContext;
14
15
16
17
18
19
20 public class Activator extends Plugin {
21
22
23 public static final String PLUGIN_ID = "pl.edu.agh.cast.schema";
24
25
26 private static Logger log;
27
28
29 private static Activator plugin;
30
31
32
33
34 public Activator() {
35 plugin = this;
36 }
37
38
39
40
41
42
43 public void start(BundleContext context) throws Exception {
44 super.start(context);
45 }
46
47
48
49
50
51
52 public void stop(BundleContext context) throws Exception {
53 plugin = null;
54 super.stop(context);
55 }
56
57
58
59
60
61
62 public static Activator getDefault() {
63 return plugin;
64 }
65
66 public static Logger getLogger() {
67 if (log == null) {
68 log = Logger.getLogger(Activator.class);
69 if (!log.getAllAppenders().hasMoreElements()) {
70
71 log.addAppender(new ConsoleAppender(new PatternLayout("%5p [%t] (%F:%L) - %m%n")));
72 }
73 }
74 return log;
75 }
76
77 }