public void nextPanel(final BeforeAfter<ShiftedSimpleContent> diff, final DiffPanel diffPanel) { final Editor editor1 = ((DiffPanelImpl) diffPanel).getEditor1(); myLeftModels.add(editor1.getScrollingModel()); final Editor editor2 = ((DiffPanelImpl) diffPanel).getEditor2(); myRightModels.add(editor2.getScrollingModel()); if (myEditor == null) { myEditor = editor1; } myLeftEditors.add(editor1); myRightEditors.add(editor2); ((EditorEx) editor1).setHorizontalScrollbarVisible(false); ((EditorEx) editor1).setVerticalScrollbarVisible(false); ((EditorEx) editor1).getScrollPane().setWheelScrollingEnabled(false); ((EditorEx) editor2).setHorizontalScrollbarVisible(false); ((EditorEx) editor2).setVerticalScrollbarVisible(false); ((EditorEx) editor2).getScrollPane().setWheelScrollingEnabled(false); }
public void setConsoleEditorEnabled(boolean consoleEditorEnabled) { if (isConsoleEditorEnabled() == consoleEditorEnabled) return; final FileEditorManagerEx fileManager = FileEditorManagerEx.getInstanceEx(getProject()); if (consoleEditorEnabled) { fileManager.closeFile(myVirtualFile); myPanel.removeAll(); myPanel.add(myHistoryViewer.getComponent()); myPanel.add(myConsoleEditor.getComponent()); myHistoryViewer.setHorizontalScrollbarVisible(false); myCurrentEditor = myConsoleEditor; } else { myPanel.removeAll(); myPanel.add(myHistoryViewer.getComponent(), BorderLayout.CENTER); myHistoryViewer.setHorizontalScrollbarVisible(true); } }
private static void setupEditorDefault(EditorEx editor) { ConsoleViewUtil.setupConsoleEditor(editor, false, false); editor.getContentComponent().setFocusCycleRoot(false); editor.setHorizontalScrollbarVisible(false); editor.setVerticalScrollbarVisible(true); editor.setBorder(null); final EditorSettings editorSettings = editor.getSettings(); editorSettings.setAdditionalLinesCount(0); editorSettings.setAdditionalColumnsCount(1); editorSettings.setRightMarginShown(false); }
private void setupComponents() { setupEditorDefault(myConsoleEditor); setupEditorDefault(myHistoryViewer); myConsoleEditor.addEditorMouseListener( EditorActionUtil.createEditorPopupHandler(IdeActions.GROUP_CONSOLE_EDITOR_POPUP)); //noinspection PointlessBooleanExpression,ConstantConditions if (SEPARATOR_THICKNESS > 0 && myShowSeparatorLine) { myHistoryViewer .getComponent() .setBorder(new SideBorder(JBColor.LIGHT_GRAY, SideBorder.BOTTOM)); } myHistoryViewer.getComponent().setMinimumSize(new Dimension(0, 0)); myHistoryViewer.getComponent().setPreferredSize(new Dimension(0, 0)); myConsoleEditor.getSettings().setAdditionalLinesCount(2); myConsoleEditor.setHighlighter( EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, myVirtualFile)); myHistoryViewer.setCaretEnabled(false); myConsoleEditor.setHorizontalScrollbarVisible(true); final VisibleAreaListener areaListener = new VisibleAreaListener() { public void visibleAreaChanged(VisibleAreaEvent e) { final int offset = myConsoleEditor.getScrollingModel().getHorizontalScrollOffset(); final ScrollingModel model = myHistoryViewer.getScrollingModel(); final int historyOffset = model.getHorizontalScrollOffset(); if (historyOffset != offset) { try { model.disableAnimation(); model.scrollHorizontally(offset); } finally { model.enableAnimation(); } } } }; myConsoleEditor.getScrollingModel().addVisibleAreaListener(areaListener); final DocumentAdapter docListener = new DocumentAdapter() { @Override public void documentChanged(final DocumentEvent e) { queueUiUpdate(false); } }; myEditorDocument.addDocumentListener(docListener, this); myHistoryViewer.getDocument().addDocumentListener(docListener, this); myHistoryViewer .getContentComponent() .addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent event) { if (isConsoleEditorEnabled() && UIUtil.isReallyTypedEvent(event)) { myConsoleEditor.getContentComponent().requestFocus(); myConsoleEditor.processKeyTyped(event); } } }); for (AnAction action : createActions()) { action.registerCustomShortcutSet(action.getShortcutSet(), myConsoleEditor.getComponent()); } EmptyAction.registerActionShortcuts( myHistoryViewer.getComponent(), myConsoleEditor.getComponent()); }