public void refreshData(final PreparedFragmentedContent fragmentedContent) { myPresentationState = new PresentationState(); myFragmentedContent = fragmentedContent; boolean navigationEnabled = !myFragmentedContent.isOneSide(); myNextDiff.setEnabled(navigationEnabled); myPreviousDiff.setEnabled(navigationEnabled); adjustPanelData((DiffPanelImpl) myHorizontal); adjustPanelData((DiffPanelImpl) myVertical); DiffPanel currentPanel = getCurrentPanel(); FragmentedDiffPanelState state = (FragmentedDiffPanelState) ((DiffPanelImpl) currentPanel).getDiffPanelState(); myTitleLabel.setText(titleText((DiffPanelImpl) currentPanel)); myLeftLines = state.getLeftLines(); myRightLines = state.getRightLines(); FragmentedEditorHighlighter bh = fragmentedContent.getBeforeHighlighter(); if (bh != null) { ((EditorEx) ((DiffPanelImpl) currentPanel).getEditor1()).setHighlighter(bh); } FragmentedEditorHighlighter ah = fragmentedContent.getAfterHighlighter(); if (ah != null) { ((EditorEx) ((DiffPanelImpl) currentPanel).getEditor2()).setHighlighter(ah); } if (((DiffPanelImpl) currentPanel).getEditor1() != null) { highlightTodo(true, fragmentedContent.getBeforeTodoRanges()); } if (((DiffPanelImpl) currentPanel).getEditor2() != null) { highlightTodo(false, fragmentedContent.getAfterTodoRanges()); } ensurePresentation(); softWraps(myConfiguration.SOFT_WRAPS_IN_SHORT_DIFF); }
private void adjustPanelData(final DiffPanelImpl diffPanel) { final FragmentedDiffPanelState diffPanelState = (FragmentedDiffPanelState) diffPanel.getDiffPanelState(); diffPanelState.setRanges(myFragmentedContent.getLineRanges()); diffPanel.setContents( new SimpleContent(myFragmentedContent.getSbOld().toString()), new SimpleContent(myFragmentedContent.getSbNew().toString())); diffPanel.setLineNumberConvertors( myFragmentedContent.getOldConvertor(), myFragmentedContent.getNewConvertor()); diffPanel.prefferedSizeByContents(-1); }
public void refreshPresentation() { // 1. vertical 2. number of lines 3. soft wraps (4. ignore spaces) PresentationState current = new PresentationState(); if (myFragmentedContent != null && !Comparing.equal(myPresentationState, current)) { myFragmentedContent.recalculate(); refreshData(myFragmentedContent); } myPreviousDiff.registerCustomShortcutSet(myPreviousDiff.getShortcutSet(), myParent); myNextDiff.registerCustomShortcutSet(myNextDiff.getShortcutSet(), myParent); }