public static FileType[] chooseContentTypes(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; }
public FragmentContent(DiffContent original, TextRange range, Project project, VirtualFile file) { this(original, range, project, file != null ? DiffContentUtil.getContentType(file) : null); }