|
Lines 23-31
Link Here
|
| 23 |
import org.eclipse.core.commands.common.CommandException; |
23 |
import org.eclipse.core.commands.common.CommandException; |
| 24 |
import org.eclipse.core.commands.common.NotDefinedException; |
24 |
import org.eclipse.core.commands.common.NotDefinedException; |
| 25 |
import org.eclipse.core.commands.util.Tracing; |
25 |
import org.eclipse.core.commands.util.Tracing; |
|
|
26 |
import org.eclipse.core.expressions.IEvaluationContext; |
| 27 |
import org.eclipse.core.runtime.AssertionFailedException; |
| 26 |
import org.eclipse.core.runtime.IStatus; |
28 |
import org.eclipse.core.runtime.IStatus; |
| 27 |
import org.eclipse.core.runtime.Status; |
29 |
import org.eclipse.core.runtime.Status; |
| 28 |
import org.eclipse.jface.bindings.Binding; |
30 |
import org.eclipse.jface.bindings.Binding; |
|
|
31 |
import org.eclipse.jface.bindings.TriggerSequence; |
| 29 |
import org.eclipse.jface.bindings.keys.KeySequence; |
32 |
import org.eclipse.jface.bindings.keys.KeySequence; |
| 30 |
import org.eclipse.jface.bindings.keys.KeyStroke; |
33 |
import org.eclipse.jface.bindings.keys.KeyStroke; |
| 31 |
import org.eclipse.jface.bindings.keys.ParseException; |
34 |
import org.eclipse.jface.bindings.keys.ParseException; |
|
Lines 53-58
Link Here
|
| 53 |
import org.eclipse.ui.internal.handlers.HandlerService; |
56 |
import org.eclipse.ui.internal.handlers.HandlerService; |
| 54 |
import org.eclipse.ui.internal.misc.Policy; |
57 |
import org.eclipse.ui.internal.misc.Policy; |
| 55 |
import org.eclipse.ui.internal.misc.StatusUtil; |
58 |
import org.eclipse.ui.internal.misc.StatusUtil; |
|
|
59 |
import org.eclipse.ui.internal.tweaklets.Tweaklets; |
| 60 |
import org.eclipse.ui.internal.tweaklets.Tweaklets.TweakKey; |
| 56 |
import org.eclipse.ui.internal.util.Util; |
61 |
import org.eclipse.ui.internal.util.Util; |
| 57 |
import org.eclipse.ui.keys.IBindingService; |
62 |
import org.eclipse.ui.keys.IBindingService; |
| 58 |
import org.eclipse.ui.statushandlers.StatusManager; |
63 |
import org.eclipse.ui.statushandlers.StatusManager; |
|
Lines 78-83
Link Here
|
| 78 |
public final class WorkbenchKeyboard { |
83 |
public final class WorkbenchKeyboard { |
| 79 |
|
84 |
|
| 80 |
/** |
85 |
/** |
|
|
86 |
* Tweaklet key for menu flashing. |
| 87 |
* |
| 88 |
* @since 3.5 |
| 89 |
*/ |
| 90 |
public static TweakKey KEY = new Tweaklets.TweakKey(MenuFlasher.class); |
| 91 |
|
| 92 |
/** |
| 93 |
* Tweaklet class for flashing the menu. |
| 94 |
* |
| 95 |
* @since 3.5 |
| 96 |
*/ |
| 97 |
public abstract static class MenuFlasher { |
| 98 |
|
| 99 |
/** |
| 100 |
* Flash a menu item that matches the provided key sequence |
| 101 |
* |
| 102 |
* @param currentState |
| 103 |
* the current context |
| 104 |
* @param triggerSequence |
| 105 |
* the trigger sequence to flash |
| 106 |
*/ |
| 107 |
public abstract void flash(IEvaluationContext currentState, |
| 108 |
TriggerSequence triggerSequence); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 81 |
* A display filter for handling key bindings. This filter can either be |
112 |
* A display filter for handling key bindings. This filter can either be |
| 82 |
* enabled or disabled. If disabled, the filter does not process incoming |
113 |
* enabled or disabled. If disabled, the filter does not process incoming |
| 83 |
* events. The filter starts enabled. |
114 |
* events. The filter starts enabled. |
|
Lines 372-377
Link Here
|
| 372 |
private final IWorkbench workbench; |
403 |
private final IWorkbench workbench; |
| 373 |
|
404 |
|
| 374 |
/** |
405 |
/** |
|
|
406 |
* Flasher tweaklet. May be <code>null</code> |
| 407 |
* |
| 408 |
* @since 3.5 |
| 409 |
*/ |
| 410 |
private MenuFlasher flasher; |
| 411 |
|
| 412 |
/** |
| 375 |
* Constructs a new instance of <code>WorkbenchKeyboard</code> associated |
413 |
* Constructs a new instance of <code>WorkbenchKeyboard</code> associated |
| 376 |
* with a particular workbench. |
414 |
* with a particular workbench. |
| 377 |
* |
415 |
* |
|
Lines 384-389
Link Here
|
| 384 |
workbench = associatedWorkbench; |
422 |
workbench = associatedWorkbench; |
| 385 |
state = new KeyBindingState(associatedWorkbench); |
423 |
state = new KeyBindingState(associatedWorkbench); |
| 386 |
workbench.addWindowListener(windowListener); |
424 |
workbench.addWindowListener(windowListener); |
|
|
425 |
try { |
| 426 |
flasher = (MenuFlasher)Tweaklets.get(KEY); |
| 427 |
} |
| 428 |
catch (AssertionFailedException e) { |
| 429 |
// no-op. No flasher, no problem. Any exceptions in creating a |
| 430 |
// flasher class would have been logged by the Tweaklets code so we |
| 431 |
// shouldn't do anything. |
| 432 |
} |
| 387 |
} |
433 |
} |
| 388 |
|
434 |
|
| 389 |
/** |
435 |
/** |
|
Lines 469-474
Link Here
|
| 469 |
} |
515 |
} |
| 470 |
|
516 |
|
| 471 |
try { |
517 |
try { |
|
|
518 |
if (flasher != null) |
| 519 |
flasher.flash(handlerService.getCurrentState(), binding.getTriggerSequence()); |
| 472 |
handlerService.executeCommand(parameterizedCommand, trigger); |
520 |
handlerService.executeCommand(parameterizedCommand, trigger); |
| 473 |
} catch (final NotDefinedException e) { |
521 |
} catch (final NotDefinedException e) { |
| 474 |
// The command is not defined. Forwarded to the IExecutionListener. |
522 |
// The command is not defined. Forwarded to the IExecutionListener. |