Search in sources :

Example 1 with ChangeCounter

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

the class MergePanel2 method setDiffRequest.

public void setDiffRequest(DiffRequest data) {
    setTitle(data.getWindowTitle());
    disposeMergeList();
    for (int i = 0; i < EDITORS_COUNT; i++) {
        getEditorPlace(i).setDocument(null);
    }
    LOG.assertTrue(!myDuringCreation);
    myDuringCreation = true;
    myProvider.putData(data.getGenericData());
    try {
        myData = data;
        String[] titles = myData.getContentTitles();
        for (int i = 0; i < myEditorsPanels.length; i++) {
            LabeledComponent editorsPanel = myEditorsPanels[i];
            editorsPanel.getLabel().setText(titles[i].isEmpty() ? " " : titles[i]);
        }
        createMergeList();
        data.customizeToolbar(myPanel.resetToolbar());
        myPanel.registerToolbarActions();
        if (data instanceof MergeRequestImpl && myBuilder != null) {
            Convertor<DialogWrapper, Boolean> preOkHook = new Convertor<DialogWrapper, Boolean>() {

                @Override
                public Boolean convert(DialogWrapper dialog) {
                    ChangeCounter counter = ChangeCounter.getOrCreate(myMergeList);
                    int changes = counter.getChangeCounter();
                    int conflicts = counter.getConflictCounter();
                    if (changes == 0 && conflicts == 0)
                        return true;
                    return Messages.showYesNoDialog(dialog.getRootPane(), DiffBundle.message("merge.dialog.apply.partially.resolved.changes.confirmation.message", changes, conflicts), DiffBundle.message("apply.partially.resolved.merge.dialog.title"), Messages.getQuestionIcon()) == Messages.YES;
                }
            };
            ((MergeRequestImpl) data).setActions(myBuilder, this, preOkHook);
        }
    } finally {
        myDuringCreation = false;
    }
}
Also used : MergeRequestImpl(com.intellij.openapi.diff.impl.mergeTool.MergeRequestImpl) ChangeCounter(com.intellij.openapi.diff.impl.incrementalMerge.ChangeCounter) LabeledComponent(com.intellij.openapi.ui.LabeledComponent) DiffDividerPaint(com.intellij.openapi.diff.impl.splitter.DiffDividerPaint) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Convertor(com.intellij.util.containers.Convertor)

Aggregations

ChangeCounter (com.intellij.openapi.diff.impl.incrementalMerge.ChangeCounter)1 MergeRequestImpl (com.intellij.openapi.diff.impl.mergeTool.MergeRequestImpl)1 DiffDividerPaint (com.intellij.openapi.diff.impl.splitter.DiffDividerPaint)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 LabeledComponent (com.intellij.openapi.ui.LabeledComponent)1 Convertor (com.intellij.util.containers.Convertor)1