From e305f1765d17ebe295f48a683a2709f7680eb5d6 Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Thu, 23 Dec 2010 15:04:46 +0300 Subject: [PATCH] [10.0.1] IDEA-62703 Pressing Alt-Right in the diff viewer causes a window switch - 2 --- .../src/com/intellij/openapi/diff/impl/DiffPanelImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index f3a85f692644..c4c6431c229b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -329,6 +329,9 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid myDataProvider.putData(myDiffRequest.getGenericData()); IdeFocusManager fm = IdeFocusManager.getInstance(myProject); + boolean isEditor1Focused = getEditor1() != null + && fm.getFocusedDescendantFor(getEditor1().getComponent()) != null; + boolean isEditor2Focused = myData.getContent2() != null && getEditor2() != null && fm.getFocusedDescendantFor(getEditor2().getComponent()) != null; @@ -348,7 +351,9 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid myPanel.setBottomComponent(newBottomComponent); - fm.requestFocus(isEditor2Focused ? getEditor2().getContentComponent() : getEditor1().getContentComponent(), true); + if (isEditor1Focused || isEditor2Focused) { + fm.requestFocus(isEditor2Focused ? getEditor2().getContentComponent() : getEditor1().getContentComponent(), true); + } myPanel.requestScrollEditors(); }