1 /*******************************************************************************
2 * Copyright (c) 2010 SAP AG.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Mathias Kinzler (SAP AG) - initial implementation
10 *******************************************************************************/
11 package org
.eclipse
.egit
.core
.internal
.trace
;
13 import org
.eclipse
.egit
.core
.Activator
;
14 import org
.eclipse
.osgi
.service
.debug
.DebugOptions
;
15 import org
.eclipse
.osgi
.service
.debug
.DebugTrace
;
18 * EGit Trace locations
21 public enum GitTraceLocation
implements ITraceLocation
{
23 CORE("/debug/core"), //$NON-NLS-1$
25 UI("/debug/ui"); //$NON-NLS-1$
28 * Initialize the locations
31 * @param pluginIsDebugging
33 public static void initializeFromOptions(DebugOptions options
, boolean pluginIsDebugging
) {
35 // we evaluate the plug-in switch
36 if (pluginIsDebugging
) {
37 myTrace
= options
.newDebugTrace(Activator
.getPluginId());
38 for (GitTraceLocation loc
: values()) {
39 boolean active
= options
.getBooleanOption(loc
.getFullPath(), false);
40 loc
.setActive(active
);
43 // if the plug-in switch is off, we don't set the trace instance
44 // to null to avoid problems with possibly running trace calls
45 for (GitTraceLocation loc
: values()) {
51 private final String location
;
52 private final String fullPath
;
54 private boolean active
= false;
55 private static DebugTrace myTrace
;
57 private GitTraceLocation(String path
) {
58 this.fullPath
= Activator
.getPluginId() + path
;
65 * @return the debug trace (may be null)
68 public static DebugTrace
getTrace() {
69 return GitTraceLocation
.myTrace
;
74 * @return <code>true</code> if this location is active
76 public boolean isActive() {
81 * @return the full path
83 public String
getFullPath() {
87 public String
getLocation() {
92 * Sets the "active" flag for this location.
94 * Used by the initializer
99 private void setActive(boolean active
) {
100 this.active
= active
;