Search in sources :

Example 1 with ComparisonPolicy

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

the class FrameDiffTool method checkNoDifferenceAndNotify.

// TODO remove check?
private boolean checkNoDifferenceAndNotify(DiffPanel diffPanel, DiffRequest data, final Window window, final boolean showMessage) {
    if (diffPanel.hasDifferences() || data.getHints().contains(HINT_ALLOW_NO_DIFFERENCES)) {
        return false;
    }
    DiffManagerImpl manager = (DiffManagerImpl) DiffManager.getInstance();
    ComparisonPolicy oldPolicy = manager.getComparisonPolicy();
    if (oldPolicy != ComparisonPolicy.DEFAULT) {
        manager.setComparisonPolicy(ComparisonPolicy.DEFAULT);
        Disposable parentDisposable = Disposer.newDisposable();
        DiffPanel maybeDiffPanel = DiffManagerImpl.createDiffPanel(data, window, parentDisposable, this);
        manager.setComparisonPolicy(oldPolicy);
        boolean hasDiffs = maybeDiffPanel.hasDifferences();
        Disposer.dispose(parentDisposable);
        if (hasDiffs) {
            return false;
        }
    }
    return !showMessage || !askForceOpenDiff(data);
}
Also used : Disposable(com.intellij.openapi.Disposable) ComparisonPolicy(com.intellij.openapi.diff.impl.ComparisonPolicy)

Example 2 with ComparisonPolicy

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

the class DiffManagerImpl method loadState.

@Override
public void loadState(Element state) {
    myProperties.readExternal(state);
    String policyName = state.getAttributeValue(COMPARISON_POLICY_ATTR_NAME);
    if (policyName != null) {
        for (ComparisonPolicy policy : ComparisonPolicy.getAllInstances()) {
            if (policy.getName().equals(policyName)) {
                myComparisonPolicy = policy;
                break;
            }
        }
    }
    String modeName = state.getAttributeValue(HIGHLIGHT_MODE_ATTR_NAME);
    if (modeName != null) {
        try {
            myHighlightMode = HighlightMode.valueOf(modeName);
        } catch (IllegalArgumentException ignore) {
        }
    }
}
Also used : ComparisonPolicy(com.intellij.openapi.diff.impl.ComparisonPolicy)

Aggregations

ComparisonPolicy (com.intellij.openapi.diff.impl.ComparisonPolicy)2 Disposable (com.intellij.openapi.Disposable)1