Example usage for com.intellij.openapi.diff DiffContent getContentType

List of usage examples for com.intellij.openapi.diff DiffContent getContentType

Introduction

In this page you can find the example usage for com.intellij.openapi.diff DiffContent getContentType.

Prototype

@Nullable
public abstract FileType getContentType();

Source Link

Usage

From source file:com.intellij.diff.actions.impl.ShowOldDiffAction.java

License:Apache License

@NotNull
private static com.intellij.openapi.diff.DiffContent convert(@Nullable Project project,
        @NotNull DiffContent content) {
    if (content instanceof EmptyContent)
        return SimpleContent.createEmpty();

    if (content instanceof DocumentContent) {
        Document document = ((DocumentContent) content).getDocument();
        return new com.intellij.openapi.diff.DocumentContent(project, document, content.getContentType());
    }//from  w  w  w.j  a  v a 2s .  c o  m
    if (content instanceof FileContent) {
        VirtualFile file = ((FileContent) content).getFile();
        return new com.intellij.openapi.diff.FileContent(project, file);
    }
    if (content instanceof DirectoryContent) {
        VirtualFile file = ((DirectoryContent) content).getFile();
        return new com.intellij.openapi.diff.FileContent(project, file);
    }

    throw new IllegalArgumentException();
}