Package com.intellij.openapi.diff.impl

Examples of com.intellij.openapi.diff.impl.DiffPanelImpl


    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;
            }
            if (hints.contains(DiffTool.HINT_DIFF_IS_APPROXIMATE)) {
                diffPanel.setPatchAppliedApproximately(); // todo read only and not variants
            }
            final Runnable onOkRunnable = request.getOnOkRunnable();
            if (onOkRunnable != null){
                builder.setOkOperation(new Runnable() {
                    @Override
                    public void run() {
                        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;
            }
            if (hints.contains(DiffTool.HINT_DIFF_IS_APPROXIMATE)) {
                diffPanel.setPatchAppliedApproximately();
            }
            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();
        }
    }
View Full Code Here


    }

    @Nullable
    private DiffPanelImpl createDiffPanelIfShouldShow(DiffRequest request, Window window, @NotNull Disposable parentDisposable,
                                                      final boolean showMessage) {
        DiffPanelImpl diffPanel = (DiffPanelImpl) createDiffPanel(request, window, parentDisposable, this);
        if (checkNoDifferenceAndNotify(diffPanel, request, window, showMessage)) {
            Disposer.dispose(diffPanel);
            diffPanel = null;
        }
        return diffPanel;
View Full Code Here

     */
    private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.external.DiffManagerImpl");
    protected DiffPanel createDiffPanel(DiffRequest data, Window window, @NotNull Disposable parentDisposable, FrameDiffTool tool) {
        DiffPanel diffPanel = null;
        try {
            diffPanel = new DiffPanelImpl(window, data.getProject(), true, true, DiffManagerImpl.FULL_DIFF_DIVIDER_POLYGONS_OFFSET, tool) {
                @Override
                public void setDiffRequest(DiffRequest data) {
                    super.setDiffRequest(data);
                    diffRequestChange(data, this);
                }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.diff.impl.DiffPanelImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.