Search in sources :

Example 1 with MergeActionGroup

use of com.intellij.openapi.diff.actions.MergeActionGroup in project intellij-community by JetBrains.

the class DiffPanelImpl method onContentChangedIn.

public void onContentChangedIn(EditorSource source) {
    myDiffUpdater.contentRemoved(source);
    final EditorEx editor = source.getEditor();
    if (myIsHorizontal && source.getSide() == FragmentSide.SIDE1 && editor != null) {
        editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
    }
    DiffSideView viewSide = getSideView(source.getSide());
    viewSide.setEditorSource(getProject(), source);
    Disposer.dispose(myScrollSupport);
    if (editor == null) {
        if (!myDisposed) {
            rediff();
        }
        return;
    }
    final MouseListener mouseListener = PopupHandler.installUnknownPopupHandler(editor.getContentComponent(), new MergeActionGroup(this, source.getSide()), ActionManager.getInstance());
    myDiffUpdater.contentAdded(source);
    editor.getSettings().setLineNumbersShown(true);
    editor.getSettings().setFoldingOutlineShown(false);
    editor.getFoldingModel().setFoldingEnabled(false);
    ((EditorMarkupModel) editor.getMarkupModel()).setErrorStripeVisible(true);
    Editor editor1 = getEditor(FragmentSide.SIDE1);
    Editor editor2 = getEditor(FragmentSide.SIDE2);
    if (editor1 != null && editor2 != null && myIsSyncScroll) {
        myScrollSupport.install(new EditingSides[] { this });
    }
    final VisibleAreaListener visibleAreaListener = mySplitter.getVisibleAreaListener();
    final ScrollingModel scrollingModel = editor.getScrollingModel();
    if (visibleAreaListener != null) {
        scrollingModel.addVisibleAreaListener(visibleAreaListener);
        scrollingModel.addVisibleAreaListener(myVisibleAreaListener);
    }
    myFontSizeSynchronizer.synchronize(editor);
    source.addDisposable(new Disposable() {

        public void dispose() {
            myFontSizeSynchronizer.stopSynchronize(editor);
        }
    });
    source.addDisposable(new Disposable() {

        public void dispose() {
            if (visibleAreaListener != null) {
                scrollingModel.removeVisibleAreaListener(visibleAreaListener);
                scrollingModel.removeVisibleAreaListener(myVisibleAreaListener);
            }
            editor.getContentComponent().removeMouseListener(mouseListener);
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable) EditorEx(com.intellij.openapi.editor.ex.EditorEx) MouseListener(java.awt.event.MouseListener) ScrollingModel(com.intellij.openapi.editor.ScrollingModel) VisibleAreaListener(com.intellij.openapi.editor.event.VisibleAreaListener) Editor(com.intellij.openapi.editor.Editor) EditorMarkupModel(com.intellij.openapi.editor.ex.EditorMarkupModel) MergeActionGroup(com.intellij.openapi.diff.actions.MergeActionGroup)

Aggregations

Disposable (com.intellij.openapi.Disposable)1 MergeActionGroup (com.intellij.openapi.diff.actions.MergeActionGroup)1 Editor (com.intellij.openapi.editor.Editor)1 ScrollingModel (com.intellij.openapi.editor.ScrollingModel)1 VisibleAreaListener (com.intellij.openapi.editor.event.VisibleAreaListener)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 EditorMarkupModel (com.intellij.openapi.editor.ex.EditorMarkupModel)1 MouseListener (java.awt.event.MouseListener)1