Search in sources :

Example 1 with BinaryLightVirtualFile

use of com.intellij.testFramework.BinaryLightVirtualFile in project intellij-community by JetBrains.

the class DiffContentFactoryImpl method createBinaryImpl.

@NotNull
private static DiffContent createBinaryImpl(@Nullable Project project, @NotNull byte[] content, @NotNull FileType type, @NotNull String fileName, @Nullable VirtualFile highlightFile) throws IOException {
    // workaround - our JarFileSystem and decompilers can't process non-local files
    boolean useTemporalFile = type instanceof ArchiveFileType || BinaryFileTypeDecompilers.INSTANCE.forFileType(type) != null;
    VirtualFile file;
    if (useTemporalFile) {
        file = createTemporalFile(project, "tmp", fileName, content);
    } else {
        file = new BinaryLightVirtualFile(fileName, type, content);
        file.setWritable(false);
    }
    return new FileContentImpl(project, file, highlightFile);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) BinaryLightVirtualFile(com.intellij.testFramework.BinaryLightVirtualFile) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) ArchiveFileType(com.intellij.ide.highlighter.ArchiveFileType) BinaryLightVirtualFile(com.intellij.testFramework.BinaryLightVirtualFile) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ArchiveFileType (com.intellij.ide.highlighter.ArchiveFileType)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 BinaryLightVirtualFile (com.intellij.testFramework.BinaryLightVirtualFile)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1 NotNull (org.jetbrains.annotations.NotNull)1