当前位置: 首页>>代码示例>>Java>>正文


Java LocalFileProvider类代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ProjectUtilCore.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PathUtil.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:PathUtil.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:39,代码来源:ProjectUtilCore.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LibrariesUtil.java

示例6: getLocalFileProviders

import com.intellij.openapi.vfs.LocalFileProvider; //导入依赖的package包/类
public abstract List<LocalFileProvider> getLocalFileProviders(); 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:2,代码来源:VirtualFileManagerEx.java


注:本文中的com.intellij.openapi.vfs.LocalFileProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。