001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal.misc;
011:
012: import org.eclipse.core.runtime.Platform;
013: import org.eclipse.ui.ISourceProvider;
014: import org.eclipse.ui.PlatformUI;
015:
016: /**
017: * A common facility for parsing the <code>org.eclipse.ui/.options</code>
018: * file.
019: *
020: * @since 2.1
021: */
022: public class Policy {
023: public static boolean DEFAULT = false;
024:
025: public static boolean DEBUG_SWT_GRAPHICS = DEFAULT;
026:
027: public static boolean DEBUG_SWT_DEBUG = DEFAULT;
028:
029: public static boolean DEBUG_DRAG_DROP = DEFAULT;
030:
031: /**
032: * Flag to log stale jobs
033: */
034: public static boolean DEBUG_STALE_JOBS = DEFAULT;
035:
036: /**
037: * Whether to report all events entering through the common event framework
038: * used by the commands architecture.
039: *
040: * @see ISourceProvider
041: * @since 3.2
042: */
043: public static boolean DEBUG_SOURCES = DEFAULT;
044:
045: /**
046: * Whether to print information about key bindings that are successfully
047: * recognized within the system (as the keys are pressed).
048: */
049: public static boolean DEBUG_KEY_BINDINGS = DEFAULT;
050:
051: /**
052: * Whether to print information about every key seen by the system.
053: */
054: public static boolean DEBUG_KEY_BINDINGS_VERBOSE = DEFAULT;
055:
056: /**
057: * Whether to print extra information about error conditions dealing with
058: * cool bars in the workbench, and their disposal.
059: */
060: public static boolean DEBUG_TOOLBAR_DISPOSAL = DEFAULT;
061:
062: /**
063: * Whether to print debugging information about the execution of commands
064: */
065: public static boolean DEBUG_COMMANDS = DEFAULT;
066:
067: /**
068: * Whether to print debugging information about the internal state of the
069: * context support within the workbench.
070: */
071: public static boolean DEBUG_CONTEXTS = DEFAULT;
072:
073: /**
074: * Whether to print debugging information about the performance of context
075: * computations.
076: */
077: public static boolean DEBUG_CONTEXTS_PERFORMANCE = DEFAULT;
078:
079: /**
080: * Whether to print even more debugging information about the internal state
081: * of the context support within the workbench.
082: */
083: public static boolean DEBUG_CONTEXTS_VERBOSE = DEFAULT;
084:
085: /**
086: * Whether to print debugging information about the internal state of the
087: * command support (in relation to handlers) within the workbench.
088: */
089: public static boolean DEBUG_HANDLERS = DEFAULT;
090:
091: /**
092: * Whether to print debugging information about the performance of handler
093: * computations.
094: */
095: public static boolean DEBUG_HANDLERS_PERFORMANCE = DEFAULT;
096:
097: /**
098: * Whether to print out verbose information about changing handlers in the
099: * workbench.
100: */
101: public static boolean DEBUG_HANDLERS_VERBOSE = DEFAULT;
102:
103: /**
104: * Whether to print debugging information about unexpected occurrences and
105: * important state changes in the operation history.
106: */
107: public static boolean DEBUG_OPERATIONS = DEFAULT;
108:
109: /**
110: * Whether to print out verbose information about the operation histories,
111: * including all notifications sent.
112: */
113: public static boolean DEBUG_OPERATIONS_VERBOSE = DEFAULT;
114:
115: /**
116: * Whether or not to show system jobs at all times.
117: */
118: public static boolean DEBUG_SHOW_ALL_JOBS = DEFAULT;
119:
120: /**
121: * Whether or not to resolve images as they are declared.
122: *
123: * @since 3.1
124: */
125: public static boolean DEBUG_DECLARED_IMAGES = DEFAULT;
126:
127: /**
128: * Whether or not to print contribution-related issues.
129: *
130: * @since 3.1
131: */
132: public static boolean DEBUG_CONTRIBUTIONS = DEFAULT;
133:
134: /**
135: * Which command identifier to print handler information for. This
136: * restricts the debugging output, so a developer can focus on one command
137: * at a time.
138: */
139: public static String DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
140:
141: /**
142: * Whether experimental features in the rendering of commands into menus
143: * and toolbars should be enabled. This is not guaranteed to provide a
144: * working workbench.
145: */
146: public static boolean EXPERIMENTAL_MENU = DEFAULT;
147:
148: public static boolean DEBUG_MPE = DEFAULT;
149:
150: /**
151: * Whether or not additional working set logging will occur.
152: *
153: * @since 3.4
154: */
155: public static boolean DEBUG_WORKING_SETS = DEFAULT;
156:
157: static {
158: if (getDebugOption("/debug")) { //$NON-NLS-1$
159: DEBUG_SWT_GRAPHICS = getDebugOption("/trace/graphics"); //$NON-NLS-1$
160: DEBUG_SWT_DEBUG = getDebugOption("/debug/swtdebug"); //$NON-NLS-1$
161: DEBUG_DRAG_DROP = getDebugOption("/trace/dragDrop"); //$NON-NLS-1$
162: DEBUG_SOURCES = getDebugOption("/trace/sources"); //$NON-NLS-1$
163: DEBUG_KEY_BINDINGS = getDebugOption("/trace/keyBindings"); //$NON-NLS-1$
164: DEBUG_KEY_BINDINGS_VERBOSE = getDebugOption("/trace/keyBindings.verbose"); //$NON-NLS-1$
165: DEBUG_TOOLBAR_DISPOSAL = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$
166: DEBUG_COMMANDS = getDebugOption("/trace/commands"); //$NON-NLS-1$
167: DEBUG_CONTEXTS = getDebugOption("/trace/contexts"); //$NON-NLS-1$
168: DEBUG_CONTEXTS_PERFORMANCE = getDebugOption("/trace/contexts.performance"); //$NON-NLS-1$
169: DEBUG_CONTEXTS_VERBOSE = getDebugOption("/trace/contexts.verbose"); //$NON-NLS-1$
170: DEBUG_HANDLERS = getDebugOption("/trace/handlers"); //$NON-NLS-1$
171: DEBUG_HANDLERS_PERFORMANCE = getDebugOption("/trace/handlers.performance"); //$NON-NLS-1$
172: DEBUG_HANDLERS_VERBOSE = getDebugOption("/trace/handlers.verbose"); //$NON-NLS-1$
173: DEBUG_OPERATIONS = getDebugOption("/trace/operations"); //$NON-NLS-1$
174: DEBUG_OPERATIONS_VERBOSE = getDebugOption("/trace/operations.verbose"); //$NON-NLS-1$
175: DEBUG_SHOW_ALL_JOBS = getDebugOption("/debug/showAllJobs"); //$NON-NLS-1$
176: DEBUG_STALE_JOBS = getDebugOption("/debug/job.stale"); //$NON-NLS-1$
177: DEBUG_HANDLERS_VERBOSE_COMMAND_ID = Platform
178: .getDebugOption(PlatformUI.PLUGIN_ID
179: + "/trace/handlers.verbose.commandId"); //$NON-NLS-1$
180: if ("".equals(DEBUG_HANDLERS_VERBOSE_COMMAND_ID)) { //$NON-NLS-1$
181: DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
182: }
183: DEBUG_DECLARED_IMAGES = getDebugOption("/debug/declaredImages"); //$NON-NLS-1$
184: DEBUG_CONTRIBUTIONS = getDebugOption("/debug/contributions"); //$NON-NLS-1$
185: EXPERIMENTAL_MENU = getDebugOption("/experimental/menus"); //$NON-NLS-1$
186: DEBUG_MPE = getDebugOption("/trace/multipageeditor"); //$NON-NLS-1$
187: DEBUG_WORKING_SETS = getDebugOption("/debug/workingSets"); //$NON-NLS-1$
188: }
189: }
190:
191: private static boolean getDebugOption(String option) {
192: return "true".equalsIgnoreCase(Platform.getDebugOption(PlatformUI.PLUGIN_ID + option)); //$NON-NLS-1$
193: }
194: }
|