Implemented mapping/unmapping of GitProvider onto a project.
[egit/egit-new.git] / org.spearce.egit.core / src / org / spearce / egit / core / GitCorePlugin.java
blobfa829ce813e15c8232dc1aabfbcf821ab18eade5
1 package org.spearce.egit.core;
3 import org.eclipse.core.runtime.IStatus;
4 import org.eclipse.core.runtime.Platform;
5 import org.eclipse.core.runtime.Plugin;
6 import org.eclipse.core.runtime.Status;
7 import org.osgi.framework.BundleContext;
9 public class GitCorePlugin extends Plugin {
10 private static GitCorePlugin plugin;
12 public static GitCorePlugin getDefault() {
13 return plugin;
16 public static String getPluginId() {
17 return getDefault().getBundle().getSymbolicName();
20 public static void log(final String message) {
21 getDefault().getLog().log(
22 new Status(IStatus.INFO, getPluginId(), IStatus.OK, message,
23 null));
26 public static void log(final String message, final int severity) {
27 getDefault().getLog().log(
28 new Status(severity, getPluginId(), IStatus.OK, message, null));
31 public static void log(final String message, final Throwable thr) {
32 getDefault().getLog().log(
33 new Status(IStatus.ERROR, getPluginId(), IStatus.OK, message,
34 thr));
37 public static boolean isTracing(final String optionId) {
38 final String option = getPluginId() + "/trace/" + optionId;
39 final String value = Platform.getDebugOption(option);
40 return value != null && value.equals("true");
43 public static void trace(final String optionId, final String what) {
44 if (isTracing(optionId)) {
45 System.out.println(what);
49 public static void traceException(final String optionId, Exception e) {
50 if (isTracing(optionId)) {
51 e.printStackTrace();
55 public GitCorePlugin() {
56 plugin = this;
59 public void start(final BundleContext context) throws Exception {
60 super.start(context);
63 public void stop(final BundleContext context) throws Exception {
64 super.stop(context);