IDEA-91177 There are no keyboard shortcuts for switching between panes and to apply diffs in differences viewer

This commit is contained in:
Konstantin Bulenkov
2012-09-08 12:37:19 +04:00
parent 08b503bf6c
commit 896f579e73
@@ -17,10 +17,7 @@ package com.intellij.openapi.diff.impl;
import com.intellij.ide.actions.EditSourceAction;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -40,6 +37,7 @@ import com.intellij.openapi.diff.impl.splitter.LineBlocks;
import com.intellij.openapi.diff.impl.util.*;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.ScrollingModel;
import com.intellij.openapi.editor.event.VisibleAreaEvent;
import com.intellij.openapi.editor.event.VisibleAreaListener;
@@ -158,9 +156,24 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
}
}
};
registerActions();
}
private void registerActions() {
// EditSourceAction is not enabled in modal context, so we need to register it here explicitly
new EditSourceAction().registerCustomShortcutSet(CommonShortcuts.getEditSource(), myPanel, this);
//control+tab switches editors
new AnAction(){
@Override
public void actionPerformed(AnActionEvent e) {
if (getEditor1() != null && getEditor2() != null) {
Editor focus = getEditor1().getContentComponent().hasFocus() ? getEditor2() : getEditor1();
IdeFocusManager.getGlobalInstance().requestFocus(focus.getContentComponent(), true);
focus.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
}
}
}.registerCustomShortcutSet(CustomShortcutSet.fromString("control TAB"), myPanel, this);
}
protected DiffPanelState createDiffPanelState(@NotNull Disposable parentDisposable) {