Lines 11-16
Link Here
|
11 |
|
11 |
|
12 |
package org.eclipse.ui.internal.handlers; |
12 |
package org.eclipse.ui.internal.handlers; |
13 |
|
13 |
|
|
|
14 |
import java.io.PrintWriter; |
15 |
import java.io.StringWriter; |
14 |
import java.util.Collection; |
16 |
import java.util.Collection; |
15 |
import java.util.HashMap; |
17 |
import java.util.HashMap; |
16 |
import java.util.HashSet; |
18 |
import java.util.HashSet; |
Lines 117-122
Link Here
|
117 |
*/ |
119 |
*/ |
118 |
private final Map handlerActivationsByCommandId = new HashMap(); |
120 |
private final Map handlerActivationsByCommandId = new HashMap(); |
119 |
|
121 |
|
|
|
122 |
private IHandlerActivation tracingNullHandlerActivation; |
123 |
|
124 |
private Exception tracingNullStack; |
125 |
|
120 |
/** |
126 |
/** |
121 |
* Constructs a new instance of <code>HandlerAuthority</code>. |
127 |
* Constructs a new instance of <code>HandlerAuthority</code>. |
122 |
* |
128 |
* |
Lines 149-154
Link Here
|
149 |
final SortedSet handlerActivations = (SortedSet) value; |
155 |
final SortedSet handlerActivations = (SortedSet) value; |
150 |
if (!handlerActivations.contains(activation)) { |
156 |
if (!handlerActivations.contains(activation)) { |
151 |
handlerActivations.add(activation); |
157 |
handlerActivations.add(activation); |
|
|
158 |
tracingNullHandlerActivation = activation; |
159 |
tracingNullStack = new Exception(); |
160 |
tracingNullStack.fillInStackTrace(); |
152 |
updateCommand(commandId, resolveConflicts(commandId, |
161 |
updateCommand(commandId, resolveConflicts(commandId, |
153 |
handlerActivations)); |
162 |
handlerActivations)); |
154 |
} |
163 |
} |
Lines 160-170
Link Here
|
160 |
handlerActivations.add(activation); |
169 |
handlerActivations.add(activation); |
161 |
handlerActivationsByCommandId |
170 |
handlerActivationsByCommandId |
162 |
.put(commandId, handlerActivations); |
171 |
.put(commandId, handlerActivations); |
|
|
172 |
tracingNullHandlerActivation = activation; |
173 |
tracingNullStack = new Exception(); |
174 |
tracingNullStack.fillInStackTrace(); |
163 |
updateCommand(commandId, resolveConflicts(commandId, |
175 |
updateCommand(commandId, resolveConflicts(commandId, |
164 |
handlerActivations)); |
176 |
handlerActivations)); |
165 |
} |
177 |
} |
166 |
} else { |
178 |
} else { |
167 |
handlerActivationsByCommandId.put(commandId, activation); |
179 |
handlerActivationsByCommandId.put(commandId, activation); |
|
|
180 |
tracingNullHandlerActivation = activation; |
181 |
tracingNullStack = new Exception(); |
182 |
tracingNullStack.fillInStackTrace(); |
168 |
updateCommand(commandId, (evaluate(activation) ? activation : null)); |
183 |
updateCommand(commandId, (evaluate(activation) ? activation : null)); |
169 |
} |
184 |
} |
170 |
|
185 |
|
Lines 208-213
Link Here
|
208 |
handlerActivations.remove(activation); |
223 |
handlerActivations.remove(activation); |
209 |
if (handlerActivations.isEmpty()) { |
224 |
if (handlerActivations.isEmpty()) { |
210 |
handlerActivationsByCommandId.remove(commandId); |
225 |
handlerActivationsByCommandId.remove(commandId); |
|
|
226 |
tracingNullHandlerActivation = activation; |
227 |
tracingNullStack = new Exception(); |
228 |
tracingNullStack.fillInStackTrace(); |
211 |
updateCommand(commandId, null); |
229 |
updateCommand(commandId, null); |
212 |
|
230 |
|
213 |
} else if (handlerActivations.size() == 1) { |
231 |
} else if (handlerActivations.size() == 1) { |
Lines 215-226
Link Here
|
215 |
.iterator().next(); |
233 |
.iterator().next(); |
216 |
handlerActivationsByCommandId.put(commandId, |
234 |
handlerActivationsByCommandId.put(commandId, |
217 |
remainingActivation); |
235 |
remainingActivation); |
|
|
236 |
tracingNullHandlerActivation = remainingActivation; |
237 |
tracingNullStack = new Exception(); |
238 |
tracingNullStack.fillInStackTrace(); |
239 |
|
218 |
updateCommand( |
240 |
updateCommand( |
219 |
commandId, |
241 |
commandId, |
220 |
(evaluate(remainingActivation) ? remainingActivation |
242 |
(evaluate(remainingActivation) ? remainingActivation |
221 |
: null)); |
243 |
: null)); |
222 |
|
244 |
|
223 |
} else { |
245 |
} else { |
|
|
246 |
tracingNullHandlerActivation = activation; |
247 |
tracingNullStack = new Exception(); |
248 |
tracingNullStack.fillInStackTrace(); |
224 |
updateCommand(commandId, resolveConflicts(commandId, |
249 |
updateCommand(commandId, resolveConflicts(commandId, |
225 |
handlerActivations)); |
250 |
handlerActivations)); |
226 |
} |
251 |
} |
Lines 228-233
Link Here
|
228 |
} else if (value instanceof IHandlerActivation) { |
253 |
} else if (value instanceof IHandlerActivation) { |
229 |
if (value == activation) { |
254 |
if (value == activation) { |
230 |
handlerActivationsByCommandId.remove(commandId); |
255 |
handlerActivationsByCommandId.remove(commandId); |
|
|
256 |
tracingNullHandlerActivation = activation; |
257 |
tracingNullStack = new Exception(); |
258 |
tracingNullStack.fillInStackTrace(); |
231 |
updateCommand(commandId, null); |
259 |
updateCommand(commandId, null); |
232 |
} |
260 |
} |
233 |
} |
261 |
} |
Lines 429-441
Link Here
|
429 |
final Object value = handlerActivationsByCommandId.get(commandId); |
457 |
final Object value = handlerActivationsByCommandId.get(commandId); |
430 |
if (value instanceof IHandlerActivation) { |
458 |
if (value instanceof IHandlerActivation) { |
431 |
final IHandlerActivation activation = (IHandlerActivation) value; |
459 |
final IHandlerActivation activation = (IHandlerActivation) value; |
|
|
460 |
tracingNullHandlerActivation = activation; |
461 |
tracingNullStack = new Exception(); |
462 |
tracingNullStack.fillInStackTrace(); |
432 |
updateCommand(commandId, (evaluate(activation) ? activation |
463 |
updateCommand(commandId, (evaluate(activation) ? activation |
433 |
: null)); |
464 |
: null)); |
434 |
} else if (value instanceof SortedSet) { |
465 |
} else if (value instanceof SortedSet) { |
435 |
final IHandlerActivation activation = resolveConflicts( |
466 |
final IHandlerActivation activation = resolveConflicts( |
436 |
commandId, (SortedSet) value); |
467 |
commandId, (SortedSet) value); |
|
|
468 |
tracingNullHandlerActivation = activation; |
469 |
tracingNullStack = new Exception(); |
470 |
tracingNullStack.fillInStackTrace(); |
437 |
updateCommand(commandId, activation); |
471 |
updateCommand(commandId, activation); |
438 |
} else { |
472 |
} else { |
|
|
473 |
tracingNullHandlerActivation = null; |
474 |
tracingNullStack = new Exception(); |
475 |
tracingNullStack.fillInStackTrace(); |
439 |
updateCommand(commandId, null); |
476 |
updateCommand(commandId, null); |
440 |
} |
477 |
} |
441 |
} |
478 |
} |
Lines 465-472
Link Here
|
465 |
final IHandlerActivation activation) { |
502 |
final IHandlerActivation activation) { |
466 |
final Command command = commandService.getCommand(commandId); |
503 |
final Command command = commandService.getCommand(commandId); |
467 |
if (activation == null) { |
504 |
if (activation == null) { |
|
|
505 |
if ((DEBUG_VERBOSE) |
506 |
&& ((DEBUG_VERBOSE_COMMAND_ID == null) || (DEBUG_VERBOSE_COMMAND_ID |
507 |
.equals(commandId)))) { |
508 |
Tracing.printTrace(TRACING_COMPONENT, "updateCommand: - " + tracingNullHandlerActivation); //$NON-NLS-1$ |
509 |
StringWriter wout = new StringWriter(); |
510 |
tracingNullStack.printStackTrace(new PrintWriter(wout)); |
511 |
Tracing.printTrace(TRACING_COMPONENT, "updateCommand: n " + wout.toString()); //$NON-NLS-1$ |
512 |
} |
468 |
command.setHandler(null); |
513 |
command.setHandler(null); |
469 |
} else { |
514 |
} else { |
|
|
515 |
if ((DEBUG_VERBOSE) |
516 |
&& ((DEBUG_VERBOSE_COMMAND_ID == null) || (DEBUG_VERBOSE_COMMAND_ID |
517 |
.equals(commandId)))) { |
518 |
Tracing.printTrace(TRACING_COMPONENT, "updateCommand: + " + tracingNullHandlerActivation); //$NON-NLS-1$ |
519 |
StringWriter wout = new StringWriter(); |
520 |
tracingNullStack.printStackTrace(new PrintWriter(wout)); |
521 |
Tracing.printTrace(TRACING_COMPONENT, "updateCommand: s " + wout.toString()); //$NON-NLS-1$ |
522 |
} |
470 |
command.setHandler(activation.getHandler()); |
523 |
command.setHandler(activation.getHandler()); |
471 |
} |
524 |
} |
472 |
} |
525 |
} |