本文整理汇总了Java中com.intellij.openapi.vfs.LocalFileProvider类的典型用法代码示例。如果您正苦于以下问题:Java LocalFileProvider类的具体用法?Java LocalFileProvider怎么用?Java LocalFileProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocalFileProvider类属于com.intellij.openapi.vfs包,在下文中一共展示了LocalFileProvider类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayUrlRelativeToProject
import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
public static String displayUrlRelativeToProject(@NotNull VirtualFile file,
@NotNull String url,
@NotNull Project project,
boolean includeFilePath,
boolean keepModuleAlwaysOnTheLeft) {
final VirtualFile baseDir = project.getBaseDir();
if (baseDir != null && includeFilePath) {
//noinspection ConstantConditions
final String projectHomeUrl = baseDir.getPresentableUrl();
if (url.startsWith(projectHomeUrl)) {
url = "..." + url.substring(projectHomeUrl.length());
}
}
if (SystemInfo.isMac && file.getFileSystem() instanceof LocalFileProvider) {
final VirtualFile fileForJar = ((LocalFileProvider)file.getFileSystem()).getLocalVirtualFileFor(file);
if (fileForJar != null) {
final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
if (libraryEntry != null) {
if (libraryEntry instanceof JdkOrderEntry) {
url = url + " - [" + ((JdkOrderEntry)libraryEntry).getJdkName() + "]";
}
else {
url = url + " - [" + libraryEntry.getPresentableName() + "]";
}
}
else {
url = url + " - [" + fileForJar.getName() + "]";
}
}
}
final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module == null) return url;
return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ?
url + " - [" + module.getName() + "]" :
"[" + module.getName() + "] - " + url;
}
示例2: getLocalFile
import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
@NotNull
public static VirtualFile getLocalFile(@NotNull VirtualFile file) {
if (!file.isValid()) {
return file;
}
if (file.getFileSystem() instanceof LocalFileProvider) {
final VirtualFile localFile = ((LocalFileProvider)file.getFileSystem()).getLocalVirtualFileFor(file);
if (localFile != null) {
return localFile;
}
}
return file;
}
示例3: getLocalFile
import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
@Nonnull
public static VirtualFile getLocalFile(@Nonnull VirtualFile file) {
if (!file.isValid()) {
return file;
}
if (file.getFileSystem() instanceof LocalFileProvider) {
final VirtualFile localFile = ((LocalFileProvider)file.getFileSystem()).getLocalVirtualFileFor(file);
if (localFile != null) {
return localFile;
}
}
return file;
}
示例4: displayUrlRelativeToProject
import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
public static String displayUrlRelativeToProject(@Nonnull VirtualFile file,
@Nonnull String url,
@Nonnull Project project,
boolean includeFilePath,
boolean keepModuleAlwaysOnTheLeft) {
final VirtualFile baseDir = project.getBaseDir();
if (baseDir != null && includeFilePath) {
//noinspection ConstantConditions
final String projectHomeUrl = baseDir.getPresentableUrl();
if (url.startsWith(projectHomeUrl)) {
url = "..." + url.substring(projectHomeUrl.length());
}
}
if (SystemInfo.isMac && file.getFileSystem() instanceof LocalFileProvider) {
final VirtualFile fileForJar = ((LocalFileProvider)file.getFileSystem()).getLocalVirtualFileFor(file);
if (fileForJar != null) {
final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
if (libraryEntry != null) {
if (libraryEntry instanceof ModuleExtensionWithSdkOrderEntry) {
url = url + " - [" + ((ModuleExtensionWithSdkOrderEntry)libraryEntry).getSdkName() + "]";
}
else {
url = url + " - [" + libraryEntry.getPresentableName() + "]";
}
}
else {
url = url + " - [" + fileForJar.getName() + "]";
}
}
}
final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module == null) return url;
return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ?
url + " - [" + module.getName() + "]" :
"[" + module.getName() + "] - " + url;
}
示例5: getLocalFor
import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
private static VirtualFile getLocalFor(VirtualFile virtualFile) {
VirtualFileSystem fileSystem = virtualFile == null ? null : virtualFile.getFileSystem();
return fileSystem instanceof LocalFileProvider ? ((LocalFileProvider)fileSystem).getLocalVirtualFileFor(virtualFile) : null;
}
示例6: getLocalFileProviders
import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
public abstract List<LocalFileProvider> getLocalFileProviders();