From 3293f940f1d42b7ecf5bdac9f971e67b3bb23e1d Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Tue, 9 Feb 2010 12:25:42 +0300 Subject: [PATCH] added diagnistics fort key gestures --- .../openapi/keymap/impl/keyGestures/KeyGestureState.java | 5 +++++ .../impl/keyGestures/KeyboardGestureProcessor.java | 16 +++++++++++++++- .../openapi/keymap/impl/keyGestures/StateContext.java | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyGestureState.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyGestureState.java index aa66fde7d6..0f39c9337a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyGestureState.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyGestureState.java @@ -39,6 +39,11 @@ abstract class KeyGestureState { myProcessor.myDblClickTimer.stop(); } + @Override + public String toString() { + return getClass().getName(); + } + boolean isPureModifierEvent(int eventType) { final KeyEvent event = myContext.keyToProcess; if (event.getID() != eventType) return false; diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java index 64eb993cd9..1aff4cc3e3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/KeyboardGestureProcessor.java @@ -58,11 +58,25 @@ public class KeyboardGestureProcessor { } public boolean process() { + boolean wasNotInWaitState = myState != myWaitForStart; + + if (Registry.is("ide.debugMode") && wasNotInWaitState) { + System.out.println("-- key gesture context: before process, state=" + myState); + System.out.println(myContext); + } + myContext.keyToProcess = myDispatcher.getContext().getInputEvent(); myContext.isModal = myDispatcher.getContext().isModalContext(); myContext.dataContext = myDispatcher.getContext().getDataContext(); - return myState.process(); + boolean result = myState.process(); + + if (Registry.is("ide.debugMode") && (wasNotInWaitState || myState != myWaitForStart)) { + System.out.println("-- key gesture context: after process, state=" + myState); + System.out.println(myContext); + } + + return result; } public boolean processInitState() { diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/StateContext.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/StateContext.java index d86f2c2702..b5ab3c8a4c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/StateContext.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/keyGestures/StateContext.java @@ -34,4 +34,18 @@ class StateContext { Component focusOwner; KeyEvent keyToProcess; boolean isModal; + + @Override + public String toString() { + return + "actionKey=" + actionKey + "\n" + + "actionShortcut=" + actionShortcut + "\n" + + "modifierType=" + modifierType + "\n" + + "actionPresentation=" + actionPresentation + "\n" + + "actionPlace=" + actionPlace + "\n" + + "dataContext=" + dataContext + "\n" + + "focusOwner=" + focusOwner + "\n" + + "keyToProcess=" + keyToProcess + "\n" + + "isModal=" + isModal + "\n"; + } } \ No newline at end of file -- 2.11.4.GIT