BinaryEditorHolder (@NotNull DiffContent content, @NotNull DiffContext context) { Project project = context.getProject(); if (content instanceof FileContent) { if (project == null) project = ProjectManager.getInstance().getDefaultProject(); VirtualFile file = ((FileContent)content).getFile(); List<FileEditorProvider> providers = FileEditorProviderManager.getInstance().getProviderList(project, file); if (providers.size() == 0) { JComponent component = FileTypeRegistry.getInstance().isFileOfType(file, UnknownFileType.INSTANCE) ? UnknownFileTypeDiffRequest.createComponent(file.getName(), context) : DiffUtil.createMessagePanel(DiffBundle.message("error.cant.show.file")); return new BinaryEditorHolder(new DumbFileEditor(file, component), null); } FileEditorProvider provider = providers.get(0); FileEditor editor = provider.createEditor(project, file); UIUtil.removeScrollBorder(editor.getComponent()); return new BinaryEditorHolder(editor, provider); } if (content instanceof DocumentContent) { Document document = ((DocumentContent)content).getDocument(); final Editor editor = DiffUtil.createEditor(document, project, true); TextEditorProvider provider = TextEditorProvider.getInstance(); TextEditor fileEditor = provider.getTextEditor(editor); Disposer.register(fileEditor, new Disposable() { @Override public void dispose() { EditorFactory.getInstance().releaseEditor(editor); } }); return new BinaryEditorHolder(fileEditor, provider); } throw new IllegalArgumentException(content.getClass() + " - " + content.toString()); }