From e3cd2467fbce909acf30f95492eadf2ef3dc4d8c Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Sun, 7 Mar 2010 11:41:57 +0300 Subject: [PATCH] double shortcuts re-fixed, previous fix caused even dispatching troubles --- .../src/com/intellij/ide/IdeEventQueue.java | 2 +- .../openapi/keymap/impl/IdeKeyEventDispatcher.java | 14 +++++++++++--- .../intellij/openapi/wm/impl/FocusManagerImpl.java | 6 ++++-- .../src/misc/registry.properties | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java index 18b431ca8c0d..1f0b844e5dc1 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java @@ -742,7 +742,7 @@ public class IdeEventQueue extends EventQueue { return peekEvent(FocusEvent.FOCUS_GAINED) != null || peekEvent(FocusEvent.FOCUS_LOST) != null; } - public boolean isReady() { + private boolean isReady() { return !myKeyboardBusy && myKeyEventDispatcher.isReady(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java index c4f0098fbd65..b16fcdb916de 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/IdeKeyEventDispatcher.java @@ -291,7 +291,10 @@ public final class IdeKeyEventDispatcher implements Disposable { myFirstKeyStroke=null; setState(KeyState.STATE_INIT); Project project = PlatformDataKeys.PROJECT.getData(myContext.getDataContext()); - WindowManager.getInstance().getStatusBar(project).setInfo(null); + StatusBar bar = WindowManager.getInstance().getStatusBar(project); + if (bar != null) { + bar.setInfo(null); + } return false; } @@ -309,7 +312,9 @@ public final class IdeKeyEventDispatcher implements Disposable { Project project = PlatformDataKeys.PROJECT.getData(myContext.getDataContext()); StatusBarEx statusBar = (StatusBarEx) WindowManager.getInstance().getStatusBar(project); if (processAction(e, myActionProcessor)) { - statusBar.setInfo(null); + if (statusBar != null) { + statusBar.setInfo(null); + } return true; } else { return false; @@ -413,7 +418,10 @@ public final class IdeKeyEventDispatcher implements Disposable { message.append(")"); } - WindowManager.getInstance().getStatusBar(project).setInfo(message.toString()); + StatusBar bar = WindowManager.getInstance().getStatusBar(project); + if (bar != null) { + bar.setInfo(message.toString()); + } mySecondStrokeTimeout.cancelAllRequests(); mySecondStrokeTimeout.addRequest(mySecondStrokeTimeoutRunnable, Registry.intValue("actionSystem.secondKeystrokeTimout")); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java index c6c7d5fc746f..5fc4b609b2e6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java @@ -72,7 +72,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable { private final Set myIdleRequests = new com.intellij.util.containers.HashSet(); private final EdtRunnable myIdleRunnable = new EdtRunnable() { public void runEdt() { - if (isFocusTransferReady() && !isIdleQueueEmpty() && IdeEventQueue.getInstance().isReady()) { + if (isFocusTransferReady() && !isIdleQueueEmpty()) { flushIdleRequests(); } else { @@ -348,7 +348,9 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable { myFlushingIdleRequestsEntryCount++; final KeyEvent[] events = myToDispatchOnDone.toArray(new KeyEvent[myToDispatchOnDone.size()]); - IdeEventQueue.getInstance().getKeyEventDispatcher().resetState(); + if (events.length > 0) { + IdeEventQueue.getInstance().getKeyEventDispatcher().resetState(); + } boolean keyWasPressed = false; diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 7f571bf49a36..3e416e34df55 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -2,7 +2,7 @@ fileIndex.background=false fileIndex.background.description=Build/update file indices in background fileIndex.background.restartRequired=true -actionSystem.fixLostTyping=false +actionSystem.fixLostTyping=true actionSystem.fixLostTyping.description=Redispatch events, lost between actions and dialog show/close actionSystem.fixStickyFocusedWindows=true actionSystem.fixNullFocusedComponent=true