Search in sources :

Example 1 with DiffTool

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

the class CompositeDiffTool method show.

public void show(DiffRequest data) {
    checkDiffData(data);
    DiffTool tool = chooseTool(data);
    if (tool != null)
        tool.show(data);
    else
        LOG.error("No diff tool found which is able to handle request " + data);
}
Also used : DiffTool(com.intellij.openapi.diff.DiffTool)

Example 2 with DiffTool

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

the class CompositeDiffTool method chooseTool.

@Nullable
private DiffTool chooseTool(DiffRequest data) {
    final DiffContent[] contents = data.getContents();
    if (contents.length == 2) {
        final FileType type1 = contents[0].getContentType();
        final FileType type2 = contents[1].getContentType();
        if (type1 == type2 && type1 instanceof UIBasedFileType) {
            return BinaryDiffTool.INSTANCE;
        }
        //todo[kb] register or not this instance in common diff tools ?
        if (type1 == type2 && type1 instanceof ArchiveFileType) {
            return ArchiveDiffTool.INSTANCE;
        }
    }
    for (DiffTool tool : myTools) {
        if (tool.canShow(data))
            return tool;
    }
    return null;
}
Also used : UIBasedFileType(com.intellij.openapi.fileTypes.UIBasedFileType) ArchiveFileType(com.intellij.ide.highlighter.ArchiveFileType) FileType(com.intellij.openapi.fileTypes.FileType) ArchiveFileType(com.intellij.ide.highlighter.ArchiveFileType) UIBasedFileType(com.intellij.openapi.fileTypes.UIBasedFileType) DiffTool(com.intellij.openapi.diff.DiffTool) DiffContent(com.intellij.openapi.diff.DiffContent) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with DiffTool

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

the class DiffManagerImpl method getDiffTool.

@Override
public DiffTool getDiffTool() {
    DiffTool[] standardTools;
    // there is inner check in multiple tool for external viewers as well
    if (!ENABLE_FILES.value(myProperties) || !ENABLE_FOLDERS.value(myProperties) || !ENABLE_MERGE.value(myProperties)) {
        DiffTool[] embeddableTools = { INTERNAL_DIFF, new MergeTool(), BinaryDiffTool.INSTANCE };
        standardTools = new DiffTool[] { ExtCompareFolders.INSTANCE, ExtCompareFiles.INSTANCE, ExtMergeFiles.INSTANCE, new MultiLevelDiffTool(Arrays.asList(embeddableTools)), INTERNAL_DIFF, new MergeTool(), BinaryDiffTool.INSTANCE };
    } else {
        standardTools = new DiffTool[] { ExtCompareFolders.INSTANCE, ExtCompareFiles.INSTANCE, ExtMergeFiles.INSTANCE, INTERNAL_DIFF, new MergeTool(), BinaryDiffTool.INSTANCE };
    }
    if (myAdditionTools.isEmpty()) {
        return new CompositeDiffTool(standardTools);
    } else {
        List<DiffTool> allTools = new ArrayList<>(myAdditionTools);
        ContainerUtil.addAll(allTools, standardTools);
        return new CompositeDiffTool(allTools);
    }
}
Also used : ArrayList(java.util.ArrayList) DiffTool(com.intellij.openapi.diff.DiffTool) MergeTool(com.intellij.openapi.diff.impl.mergeTool.MergeTool)

Aggregations

DiffTool (com.intellij.openapi.diff.DiffTool)3 ArchiveFileType (com.intellij.ide.highlighter.ArchiveFileType)1 DiffContent (com.intellij.openapi.diff.DiffContent)1 MergeTool (com.intellij.openapi.diff.impl.mergeTool.MergeTool)1 FileType (com.intellij.openapi.fileTypes.FileType)1 UIBasedFileType (com.intellij.openapi.fileTypes.UIBasedFileType)1 ArrayList (java.util.ArrayList)1 Nullable (org.jetbrains.annotations.Nullable)1