mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
StandardFileSystems class in core-api introduced
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.vfs;
|
||||
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class StandardFileSystems {
|
||||
public static String FILE_PROTOCOL = "file";
|
||||
public static String JAR_PROTOCOL = "jar";
|
||||
|
||||
private static final NotNullLazyValue<VirtualFileSystem> ourLocal = new NotNullLazyValue<VirtualFileSystem>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected VirtualFileSystem compute() {
|
||||
return VirtualFileManager.getInstance().getFileSystem(FILE_PROTOCOL);
|
||||
}
|
||||
};
|
||||
|
||||
private static final NotNullLazyValue<VirtualFileSystem> ourJar = new NotNullLazyValue<VirtualFileSystem>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected VirtualFileSystem compute() {
|
||||
return VirtualFileManager.getInstance().getFileSystem(JAR_PROTOCOL);
|
||||
}
|
||||
};
|
||||
|
||||
public static VirtualFileSystem local() {
|
||||
return ourLocal.getValue();
|
||||
}
|
||||
|
||||
public static VirtualFileSystem jar() {
|
||||
return ourJar.getValue();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.vfs.impl.jar;
|
||||
|
||||
import com.intellij.openapi.vfs.DeprecatedVirtualFileSystem;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -33,7 +34,7 @@ public class CoreJarFileSystem extends DeprecatedVirtualFileSystem {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return "jar";
|
||||
return StandardFileSystems.JAR_PROTOCOL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.vfs.local;
|
||||
|
||||
import com.intellij.openapi.vfs.DeprecatedVirtualFileSystem;
|
||||
import com.intellij.openapi.vfs.StandardFileSystems;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -30,7 +31,7 @@ public class CoreLocalFileSystem extends DeprecatedVirtualFileSystem {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return "file";
|
||||
return StandardFileSystems.FILE_PROTOCOL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,7 +26,7 @@ import java.io.IOException;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public abstract class JarFileSystem extends NewVirtualFileSystem {
|
||||
@NonNls public static final String PROTOCOL = "jar";
|
||||
@NonNls public static final String PROTOCOL = StandardFileSystems.JAR_PROTOCOL;
|
||||
@NonNls public static final String PROTOCOL_PREFIX = "jar://";
|
||||
@NonNls public static final String JAR_SEPARATOR = "!/";
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Set;
|
||||
import static java.util.Collections.singleton;
|
||||
|
||||
public abstract class LocalFileSystem extends NewVirtualFileSystem {
|
||||
@NonNls public static final String PROTOCOL = "file";
|
||||
@NonNls public static final String PROTOCOL = StandardFileSystems.FILE_PROTOCOL;
|
||||
@NonNls public static final String PROTOCOL_PREFIX = PROTOCOL + "://";
|
||||
|
||||
@SuppressWarnings("UtilityClassWithoutPrivateConstructor")
|
||||
|
||||
Reference in New Issue
Block a user