From 9d702fa6b2ad588caf969e4e0fcc602578c613be Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Tue, 13 Oct 2020 14:45:48 +0200 Subject: [PATCH] add getInstance for JrtFileSystem GitOrigin-RevId: bdfcda4885a755628f804d0a4180eec0eaba33d3 --- .../src/com/intellij/openapi/vfs/jrt/JrtFileSystem.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/openapi/src/com/intellij/openapi/vfs/jrt/JrtFileSystem.java b/java/openapi/src/com/intellij/openapi/vfs/jrt/JrtFileSystem.java index 62e5e0cf07cd..e8fa22ebeb1e 100644 --- a/java/openapi/src/com/intellij/openapi/vfs/jrt/JrtFileSystem.java +++ b/java/openapi/src/com/intellij/openapi/vfs/jrt/JrtFileSystem.java @@ -1,7 +1,8 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vfs.jrt; import com.intellij.openapi.vfs.StandardFileSystems; +import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.openapi.vfs.VirtualFilePointerCapableFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem; @@ -13,6 +14,10 @@ public abstract class JrtFileSystem extends ArchiveFileSystem implements Virtual public static final String PROTOCOL_PREFIX = StandardFileSystems.JRT_PROTOCOL_PREFIX; public static final String SEPARATOR = URLUtil.JAR_SEPARATOR; + public static JrtFileSystem getInstance() { + return (JrtFileSystem)VirtualFileManager.getInstance().getFileSystem(PROTOCOL); + } + public static boolean isRoot(@NotNull VirtualFile file) { return file.getParent() == null && file.getFileSystem() instanceof JrtFileSystem; }