Search in sources :

Example 1 with DiffPanelImpl

use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.

the class FocusOppositePaneAction method update.

@Override
public void update(final AnActionEvent e) {
    final DiffPanelImpl diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext());
    e.getPresentation().setEnabled(diffPanel != null);
}
Also used : DiffPanelImpl(com.intellij.openapi.diff.impl.DiffPanelImpl)

Example 2 with DiffPanelImpl

use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.

the class FrameDiffTool method createDiffPanelIfShouldShow.

/*public static void createEditableDiffFrame(final DiffRequest request) {
    final FrameWrapper frameWrapper = new FrameWrapper(request.getProject(), request.getGroupKey());
    DiffPanelImpl diffPanel = createDiffPanelIfShouldShow(request, frameWrapper.getFrame(), frameWrapper);
    if (diffPanel == null) return;
    diffPanel.setPatchAppliedApproximately();

    frameWrapper.setTitle(request.getWindowTitle());

    final DialogBuilder builder = new DialogBuilder(request.getProject());
    builder.setCenterPanel(diffPanel.getComponent());
    builder.setPreferedFocusComponent(diffPanel.getPreferredFocusedComponent());

    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(builder.getCenterPanel(), BorderLayout.CENTER);
    panel.add(builder.getDialogWrapper().get);

    DiffUtil.initDiffFrame(frameWrapper, diffPanel);

    new AnAction() {
      public void actionPerformed(final AnActionEvent e) {
        frameWrapper.getFrame().dispose();
      }
    }.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")),
                                diffPanel.getComponent());

    frameWrapper.show();
  }*/
@Nullable
private DiffPanelImpl createDiffPanelIfShouldShow(DiffRequest request, Window window, @NotNull Disposable parentDisposable, final boolean showMessage) {
    DiffPanelImpl diffPanel = createDiffPanelImpl(request, window, parentDisposable);
    if (checkNoDifferenceAndNotify(diffPanel, request, window, showMessage)) {
        Disposer.dispose(diffPanel);
        diffPanel = null;
    }
    return diffPanel;
}
Also used : DiffPanelImpl(com.intellij.openapi.diff.impl.DiffPanelImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with DiffPanelImpl

use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.

the class FrameDiffTool method show.

public void show(DiffRequest request) {
    Collection hints = request.getHints();
    boolean shouldOpenDialog = shouldOpenDialog(hints);
    if (shouldOpenDialog) {
        final DialogBuilder builder = new DialogBuilder(request.getProject());
        DiffPanelImpl diffPanel = createDiffPanelIfShouldShow(request, builder.getWindow(), builder, true);
        if (diffPanel == null) {
            Disposer.dispose(builder);
            return;
        }
        final Runnable onOkRunnable = request.getOnOkRunnable();
        if (onOkRunnable != null) {
            builder.setOkOperation(() -> {
                builder.getDialogWrapper().close(0);
                onOkRunnable.run();
            });
        } else {
            builder.removeAllActions();
        }
        builder.setCenterPanel(diffPanel.getComponent());
        builder.setPreferredFocusComponent(diffPanel.getPreferredFocusedComponent());
        builder.setTitle(request.getWindowTitle());
        builder.setDimensionServiceKey(request.getGroupKey());
        new AnAction() {

            public void actionPerformed(final AnActionEvent e) {
                builder.getDialogWrapper().close(0);
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")), diffPanel.getComponent());
        showDiffDialog(builder, hints);
    } else {
        final FrameWrapper frameWrapper = new FrameWrapper(request.getProject(), request.getGroupKey());
        DiffPanelImpl diffPanel = createDiffPanelIfShouldShow(request, frameWrapper.getFrame(), frameWrapper, true);
        if (diffPanel == null) {
            Disposer.dispose(frameWrapper);
            return;
        }
        frameWrapper.setTitle(request.getWindowTitle());
        DiffUtil.initDiffFrame(diffPanel.getProject(), frameWrapper, diffPanel, diffPanel.getComponent());
        new AnAction() {

            public void actionPerformed(final AnActionEvent e) {
                frameWrapper.getFrame().dispose();
            }
        }.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")), diffPanel.getComponent());
        frameWrapper.show();
    }
}
Also used : CustomShortcutSet(com.intellij.openapi.actionSystem.CustomShortcutSet) DiffPanelImpl(com.intellij.openapi.diff.impl.DiffPanelImpl) Collection(java.util.Collection) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) FrameWrapper(com.intellij.openapi.ui.FrameWrapper) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 4 with DiffPanelImpl

use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.

the class FocusOppositePaneAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final DiffPanelImpl diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext());
    assert diffPanel != null;
    diffPanel.focusOppositeSide();
}
Also used : DiffPanelImpl(com.intellij.openapi.diff.impl.DiffPanelImpl)

Aggregations

DiffPanelImpl (com.intellij.openapi.diff.impl.DiffPanelImpl)4 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 CustomShortcutSet (com.intellij.openapi.actionSystem.CustomShortcutSet)1 DialogBuilder (com.intellij.openapi.ui.DialogBuilder)1 FrameWrapper (com.intellij.openapi.ui.FrameWrapper)1 Collection (java.util.Collection)1 Nullable (org.jetbrains.annotations.Nullable)1