Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3c2b72d9b9c3b6a1ee70e870e3303245b1909350 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.internal.misc;

import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.graphics.Device;
import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.PlatformUI;

/**
 * A common facility for parsing the <code>org.eclipse.ui/.options</code>
 * file.
 *
 * @since 2.1
 */
public class Policy {
    public static boolean DEFAULT = false;

    public static boolean DEBUG_SWT_GRAPHICS = DEFAULT;

    public static boolean DEBUG_SWT_DEBUG = DEFAULT;

    public static boolean DEBUG_SWT_DEBUG_GLOBAL = DEFAULT;

    public static boolean DEBUG_DRAG_DROP = DEFAULT;

    /**
     * Flag to log stale jobs
     */
    public static boolean DEBUG_STALE_JOBS = DEFAULT;

    /**
	 * Whether to report all events entering through the common event framework
	 * used by the commands architecture.
	 *
	 * @see ISourceProvider
	 * @since 3.2
	 */
    public static boolean DEBUG_SOURCES = DEFAULT;

    /**
     * Whether to print information about key bindings that are successfully
     * recognized within the system (as the keys are pressed).
     */
    public static boolean DEBUG_KEY_BINDINGS = DEFAULT;

    /**
     * Whether to print information about every key seen by the system.
     */
    public static boolean DEBUG_KEY_BINDINGS_VERBOSE = DEFAULT;

    /**
     * Whether to print extra information about error conditions dealing with
     * cool bars in the workbench, and their disposal.
     */
    public static boolean DEBUG_TOOLBAR_DISPOSAL = DEFAULT;

    /**
     * Whether to print debugging information about the execution of commands
     */
    public static boolean DEBUG_COMMANDS = DEFAULT;

    /**
     * Whether to print debugging information about the internal state of the
     * context support within the workbench.
     */
    public static boolean DEBUG_CONTEXTS = DEFAULT;

    /**
     * Whether to print debugging information about the performance of context
     * computations.
     */
    public static boolean DEBUG_CONTEXTS_PERFORMANCE = DEFAULT;

    /**
     * Whether to print even more debugging information about the internal state
     * of the context support within the workbench.
     */
    public static boolean DEBUG_CONTEXTS_VERBOSE = DEFAULT;

    /**
     * Whether to print debugging information about the internal state of the
     * command support (in relation to handlers) within the workbench.
     */
    public static boolean DEBUG_HANDLERS = DEFAULT;

    /**
     * Whether to print debugging information about the performance of handler
     * computations.
     */
    public static boolean DEBUG_HANDLERS_PERFORMANCE = DEFAULT;

    /**
     * Whether to print out verbose information about changing handlers in the
     * workbench.
     */
    public static boolean DEBUG_HANDLERS_VERBOSE = DEFAULT;

    /**
     * Whether to print debugging information about unexpected occurrences and
     * important state changes in the operation history.
     */
    public static boolean DEBUG_OPERATIONS = DEFAULT;

    /**
     * Whether to print out verbose information about the operation histories,
     * including all notifications sent.
     */
    public static boolean DEBUG_OPERATIONS_VERBOSE = DEFAULT;


    /**
     * Whether or not to show system jobs at all times.
     */
    public static boolean DEBUG_SHOW_ALL_JOBS = DEFAULT;

    /**
     * Whether or not to resolve images as they are declared.
     *
     * @since 3.1
     */
    public static boolean DEBUG_DECLARED_IMAGES = DEFAULT;

    /**
     * Whether or not to print contribution-related issues.
     *
     * @since 3.1
     */
    public static boolean DEBUG_CONTRIBUTIONS = DEFAULT;

    /**
     * Which command identifier to print handler information for.  This
     * restricts the debugging output, so a developer can focus on one command
     * at a time.
     */
    public static String DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;

    /**
     * Whether experimental features in the rendering of commands into menus
     * and toolbars should be enabled.  This is not guaranteed to provide a
     * working workbench.
     */
    public static boolean EXPERIMENTAL_MENU = DEFAULT;

    public static boolean DEBUG_MPE = DEFAULT;

    /**
     * Whether or not additional working set logging will occur.
     *
     * @since 3.4
     */
    public static boolean DEBUG_WORKING_SETS = DEFAULT;

    static {
        if (getDebugOption("/debug")) { //$NON-NLS-1$
            DEBUG_SWT_GRAPHICS = getDebugOption("/trace/graphics"); //$NON-NLS-1$
            DEBUG_SWT_DEBUG = getDebugOption("/debug/swtdebug"); //$NON-NLS-1$
            DEBUG_SWT_DEBUG_GLOBAL = getDebugOption("/debug/swtdebugglobal"); //$NON-NLS-1$
            DEBUG_DRAG_DROP = getDebugOption("/trace/dragDrop"); //$NON-NLS-1$
            DEBUG_SOURCES = getDebugOption("/trace/sources"); //$NON-NLS-1$
            DEBUG_KEY_BINDINGS = getDebugOption("/trace/keyBindings"); //$NON-NLS-1$
            DEBUG_KEY_BINDINGS_VERBOSE = getDebugOption("/trace/keyBindings.verbose"); //$NON-NLS-1$
            DEBUG_TOOLBAR_DISPOSAL = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$
            DEBUG_COMMANDS = getDebugOption("/trace/commands"); //$NON-NLS-1$
            DEBUG_CONTEXTS = getDebugOption("/trace/contexts"); //$NON-NLS-1$
            DEBUG_CONTEXTS_PERFORMANCE = getDebugOption("/trace/contexts.performance"); //$NON-NLS-1$
            DEBUG_CONTEXTS_VERBOSE = getDebugOption("/trace/contexts.verbose"); //$NON-NLS-1$
            DEBUG_HANDLERS = getDebugOption("/trace/handlers"); //$NON-NLS-1$
            DEBUG_HANDLERS_PERFORMANCE = getDebugOption("/trace/handlers.performance"); //$NON-NLS-1$
            DEBUG_HANDLERS_VERBOSE = getDebugOption("/trace/handlers.verbose"); //$NON-NLS-1$
            DEBUG_OPERATIONS = getDebugOption("/trace/operations"); //$NON-NLS-1$
            DEBUG_OPERATIONS_VERBOSE = getDebugOption("/trace/operations.verbose"); //$NON-NLS-1$
            DEBUG_SHOW_ALL_JOBS = getDebugOption("/debug/showAllJobs"); //$NON-NLS-1$
            DEBUG_STALE_JOBS = getDebugOption("/debug/job.stale"); //$NON-NLS-1$
            DEBUG_HANDLERS_VERBOSE_COMMAND_ID = Platform
                    .getDebugOption(PlatformUI.PLUGIN_ID
                            + "/trace/handlers.verbose.commandId"); //$NON-NLS-1$
            if ("".equals(DEBUG_HANDLERS_VERBOSE_COMMAND_ID)) { //$NON-NLS-1$
            	DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
            }
            DEBUG_DECLARED_IMAGES = getDebugOption("/debug/declaredImages"); //$NON-NLS-1$
            DEBUG_CONTRIBUTIONS = getDebugOption("/debug/contributions"); //$NON-NLS-1$
            EXPERIMENTAL_MENU = getDebugOption("/experimental/menus"); //$NON-NLS-1$
            DEBUG_MPE = getDebugOption("/trace/multipageeditor"); //$NON-NLS-1$
            DEBUG_WORKING_SETS = getDebugOption("/debug/workingSets"); //$NON-NLS-1$

            if(DEBUG_SWT_DEBUG_GLOBAL)
            	Device.DEBUG = true;
        }
    }

    private static boolean getDebugOption(String option) {
        return "true".equalsIgnoreCase(Platform.getDebugOption(PlatformUI.PLUGIN_ID + option)); //$NON-NLS-1$
    }
}

Back to the top