Search in sources :

Example 6 with DiffContent

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

the class DiffSideView method setMouseListeners.

private void setMouseListeners(EditorSource source) {
    DiffContent content = source.getContent();
    MouseLineNumberListener.install(content, source, myContainer);
}
Also used : DiffContent(com.intellij.openapi.diff.DiffContent)

Example 7 with DiffContent

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

the class DiffUtil method chooseContentTypes.

@NotNull
public static FileType[] chooseContentTypes(@NotNull DiffContent[] contents) {
    FileType commonType = FileTypes.PLAIN_TEXT;
    for (DiffContent content : contents) {
        FileType contentType = content.getContentType();
        if (DiffContentUtil.isTextType(contentType))
            commonType = contentType;
    }
    FileType[] result = new FileType[contents.length];
    for (int i = 0; i < contents.length; i++) {
        FileType contentType = contents[i].getContentType();
        result[i] = DiffContentUtil.isTextType(contentType) ? contentType : commonType;
    }
    return result;
}
Also used : FileType(com.intellij.openapi.fileTypes.FileType) DiffContent(com.intellij.openapi.diff.DiffContent) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with DiffContent

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

the class DiffContentFactory method compareVirtualFiles.

@Nullable
public static SimpleDiffRequest compareVirtualFiles(Project project, VirtualFile file1, VirtualFile file2, String title) {
    DiffContent content1 = DiffContent.fromFile(project, file1);
    DiffContent content2 = DiffContent.fromFile(project, file2);
    if (content1 == null || content2 == null)
        return null;
    SimpleDiffRequest diffRequest = new SimpleDiffRequest(project, title);
    diffRequest.setContents(content1, content2);
    return diffRequest;
}
Also used : SimpleDiffRequest(com.intellij.openapi.diff.SimpleDiffRequest) DiffContent(com.intellij.openapi.diff.DiffContent) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DiffContent (com.intellij.openapi.diff.DiffContent)8 FileType (com.intellij.openapi.fileTypes.FileType)3 Nullable (org.jetbrains.annotations.Nullable)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ArchiveFileType (com.intellij.ide.highlighter.ArchiveFileType)1 DiffRequest (com.intellij.openapi.diff.DiffRequest)1 DiffTool (com.intellij.openapi.diff.DiffTool)1 MergeRequest (com.intellij.openapi.diff.MergeRequest)1 SimpleDiffRequest (com.intellij.openapi.diff.SimpleDiffRequest)1 Document (com.intellij.openapi.editor.Document)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1 UIBasedFileType (com.intellij.openapi.fileTypes.UIBasedFileType)1 File (java.io.File)1 IOException (java.io.IOException)1 NotNull (org.jetbrains.annotations.NotNull)1