• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StandardFileSystems类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.vfs.StandardFileSystems的典型用法代码示例。如果您正苦于以下问题:Java StandardFileSystems类的具体用法?Java StandardFileSystems怎么用?Java StandardFileSystems使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StandardFileSystems类属于com.intellij.openapi.vfs包,在下文中一共展示了StandardFileSystems类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadModuleInternal

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@NotNull
private Module loadModuleInternal(@NotNull String filePath) throws ModuleWithNameAlreadyExists, IOException {
  filePath = resolveShortWindowsName(filePath);
  final VirtualFile moduleFile = StandardFileSystems.local().findFileByPath(filePath);
  if (moduleFile == null || !moduleFile.exists()) {
    throw new FileNotFoundException(ProjectBundle.message("module.file.does.not.exist.error", filePath));
  }

  String path = moduleFile.getPath();
  ModuleEx module = getModuleByFilePath(path);
  if (module == null) {
    ApplicationManager.getApplication().invokeAndWait(new Runnable() {
      @Override
      public void run() {
        moduleFile.refresh(false, false);
      }
    }, ModalityState.any());
    module = createAndLoadModule(path);
    initModule(module, path, null);
  }
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ModuleManagerImpl.java


示例2: getUserSkeletonsDirectory

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Nullable
public static VirtualFile getUserSkeletonsDirectory() {
  if (ourUserSkeletonsDirectory == null) {
    for (String path : getPossibleUserSkeletonsPaths()) {
      ourUserSkeletonsDirectory = StandardFileSystems.local().findFileByPath(path);
      if (ourUserSkeletonsDirectory != null) {
        break;
      }
    }
  }
  if (!ourNoSkeletonsErrorReported && ourUserSkeletonsDirectory == null) {
    ourNoSkeletonsErrorReported = true;
    LOG.warn("python-skeletons directory not found in paths: " + getPossibleUserSkeletonsPaths());
  }
  return ourUserSkeletonsDirectory;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PyUserSkeletonsUtil.java


示例3: findXmlFile

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Nullable
public static XmlFile findXmlFile(PsiFile base, @NotNull String uri) {
  PsiFile result = null;

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    String data = base.getOriginalFile().getUserData(TEST_PATH);

    if (data != null) {
      String filePath = data + "/" + uri;
      final VirtualFile path = StandardFileSystems.local().findFileByPath(filePath.replace(File.separatorChar, '/'));
      if (path != null) {
        result = base.getManager().findFile(path);
      }
    }
  }
  if (result == null) {
    result = findRelativeFile(uri, base);
  }

  if (result instanceof XmlFile) {
    return (XmlFile)result;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:XmlUtil.java


示例4: calcRoots

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
private static List<VirtualFile> calcRoots(@Nullable VirtualFile home) {
  if (home == null) {
    return Collections.emptyList();
  }

  final VirtualFile lib = home.findChild("lib");
  if (lib == null) {
    return Collections.emptyList();
  }

  List<VirtualFile> result = new ArrayList<VirtualFile>();
  for (VirtualFile file : lib.getChildren()) {
    if ("jar".equals(file.getExtension())) {
      ContainerUtil.addIfNotNull(StandardFileSystems.getJarRootForLocalFile(file), result);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SdkHomeSettings.java


示例5: pathToUrl

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
protected static String pathToUrl(File path) {
  String name = path.getName();
  boolean isJarFile =
      FileUtilRt.extensionEquals(name, "jar") || FileUtilRt.extensionEquals(name, "zip");
  // .jar files require an URL with "jar" protocol.
  String protocol =
      isJarFile
          ? StandardFileSystems.JAR_PROTOCOL
          : VirtualFileSystemProvider.getInstance().getSystem().getProtocol();
  String filePath = FileUtil.toSystemIndependentName(path.getPath());
  String url = VirtualFileManager.constructUrl(protocol, filePath);
  if (isJarFile) {
    url += URLUtil.JAR_SEPARATOR;
  }
  return url;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:BlazeLibrary.java


示例6: Unity3dProjectChangeListener

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
public Unity3dProjectChangeListener(@NotNull Project project, @NotNull StartupManager startupManager)
{
	myProject = project;

	for(Unity3dProjectSourceFileTypeFactory factory : Unity3dProjectSourceFileTypeFactory.EP_NAME.getExtensions())
	{
		factory.registerFileTypes(mySourceFileTypes::add);
	}

	myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener()
	{
		@Override
		@RequiredReadAction
		public void rootsChanged(ModuleRootEvent event)
		{
			checkAndRunIfNeed();
		}
	});

	VirtualFileManager.getInstance().addVirtualFileListener(this, this);

	myAssetsDirPointer = VirtualFilePointerManager.getInstance().create(StandardFileSystems.FILE_PROTOCOL_PREFIX + myProject.getPresentableUrl() + "/" + Unity3dProjectImportUtil
			.ASSETS_DIRECTORY, this, null);

	startupManager.registerPostStartupActivity(this::checkAndRunIfNeed);
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:27,代码来源:Unity3dProjectChangeListener.java


示例7: newModule

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Override
@Nonnull
public Module newModule(@Nonnull @NonNls String name, @Nullable @NonNls String dirPath) {
  assertWritable();

  final String dirUrl = dirPath == null ? null : VirtualFileManager.constructUrl(StandardFileSystems.FILE_PROTOCOL, dirPath);

  ModuleEx moduleEx = null;
  if (dirUrl != null) {
    moduleEx = getModuleByDirUrl(dirUrl);
  }

  if (moduleEx == null) {
    moduleEx = createModule(name, dirUrl, null);
    initModule(moduleEx);
  }
  return moduleEx;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:ModuleManagerImpl.java


示例8: testFindRootShouldNotBeFooledByRelativePath

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
public void testFindRootShouldNotBeFooledByRelativePath() throws IOException {
  File tmp = createTempDirectory();
  File x = new File(tmp, "x.jar");
  x.createNewFile();
  LocalFileSystem lfs = LocalFileSystem.getInstance();
  VirtualFile vx = lfs.refreshAndFindFileByIoFile(x);
  assertNotNull(vx);
  ArchiveFileSystem jfs = (ArchiveFileSystem)StandardFileSystems.jar();
  VirtualFile root = ArchiveVfsUtil.getArchiveRootForLocalFile(vx);

  PersistentFS fs = PersistentFS.getInstance();

  String path = vx.getPath() + "/../" + vx.getName() + ArchiveFileSystem.ARCHIVE_SEPARATOR;
  NewVirtualFile root1 = fs.findRoot(path, (NewVirtualFileSystem)jfs);

  assertSame(root1, root);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PersistentFSTest.java


示例9: testDocumentReuse

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
public void testDocumentReuse() throws IOException {
  File classFile = new File(FileUtil.getTempDirectory(), "ReuseTest.class");
  FileUtil.writeToFile(classFile, "");
  VirtualFile vFile = StandardFileSystems.local().findFileByPath(classFile.getPath());
  assertNotNull(classFile.getPath(), vFile);
  PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(vFile);
  assertNotNull(psiFile);
  String testDir = getTestDataDir();

  FileUtil.copy(new File(testDir, "pkg/ReuseTestV1.class"), classFile);
  vFile.refresh(false, false);
  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
  String text1 = psiFile.getText();
  assertTrue(text1, text1.contains("private int f1"));
  assertFalse(text1, text1.contains("private int f2"));
  Document doc1 = FileDocumentManager.getInstance().getCachedDocument(vFile);
  assertNotNull(doc1);
  assertSame(doc1, PsiDocumentManager.getInstance(getProject()).getDocument(psiFile));

  FileUtil.copy(new File(testDir, "pkg/ReuseTestV2.class"), classFile);
  vFile.refresh(false, false);
  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
  String text2 = psiFile.getText();
  assertTrue(text2, text2.contains("private int f1"));
  assertTrue(text2, text2.contains("private int f2"));
  Document doc2 = FileDocumentManager.getInstance().getCachedDocument(vFile);
  assertNotNull(doc2);
  assertSame(doc2, PsiDocumentManager.getInstance(getProject()).getDocument(psiFile));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ClsMirrorBuildingTest.java


示例10: testElementAt

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
public void testElementAt() {
  String path = getTestDataDir() + "/pkg/SimpleEnum.class";
  VirtualFile vFile = StandardFileSystems.local().findFileByPath(path);
  assertNotNull(path, vFile);
  PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(vFile);
  assertNotNull(path, psiFile);
  for (int i = 0; i < psiFile.getTextLength(); i++) {
    PsiElement element = psiFile.findElementAt(i);
    assertTrue(i + ":" + element, element == null || element instanceof ClsElementImpl && !(element instanceof PsiFile));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ClsMirrorBuildingTest.java


示例11: doTest

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
private static void doTest(String clsPath, String txtPath) {
  VirtualFile file = (clsPath.contains("!/") ? StandardFileSystems.jar() : StandardFileSystems.local()).findFileByPath(clsPath);
  assertNotNull(clsPath, file);

  String expected;
  try {
    expected = StringUtil.trimTrailing(PlatformTestUtil.loadFileText(txtPath));
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }

  assertEquals(expected, ClsFileImpl.decompile(file).toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ClsMirrorBuildingTest.java


示例12: canonicalizeUrl

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
protected Url canonicalizeUrl(@NotNull String url, @Nullable Url baseUrl, boolean trimFileScheme, int sourceIndex, boolean baseUrlIsFile) {
  if (trimFileScheme && url.startsWith(StandardFileSystems.FILE_PROTOCOL_PREFIX)) {
    return Urls.newLocalFileUrl(FileUtil.toCanonicalPath(VfsUtilCore.toIdeaUrl(url, true).substring(StandardFileSystems.FILE_PROTOCOL_PREFIX.length()), '/'));
  }
  else if (baseUrl == null || url.contains(URLUtil.SCHEME_SEPARATOR) || url.startsWith("data:") || url.startsWith("blob:") || url.startsWith("javascript:")) {
    return Urls.parseEncoded(url);
  }

  String path = canonicalizePath(url, baseUrl, baseUrlIsFile);
  if (baseUrl.getScheme() == null && baseUrl.isInLocalFileSystem()) {
    return Urls.newLocalFileUrl(path);
  }

  // browserify produces absolute path in the local filesystem
  if (isAbsolute(path)) {
    VirtualFile file = LocalFileFinder.findFile(path);
    if (file != null) {
      if (absoluteLocalPathToSourceIndex == null) {
        // must be linked, on iterate original path must be first
        absoluteLocalPathToSourceIndex = createStringIntMap(rawSources.size());
        sourceIndexToAbsoluteLocalPath = new String[rawSources.size()];
      }
      absoluteLocalPathToSourceIndex.put(path, sourceIndex);
      sourceIndexToAbsoluteLocalPath[sourceIndex] = path;
      String canonicalPath = file.getCanonicalPath();
      if (canonicalPath != null && !canonicalPath.equals(path)) {
        absoluteLocalPathToSourceIndex.put(canonicalPath, sourceIndex);
      }
      return Urls.newLocalFileUrl(path);
    }
  }
  return new UrlImpl(baseUrl.getScheme(), baseUrl.getAuthority(), path, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:SourceResolver.java


示例13: getHomeDirectory

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Override
public VirtualFile getHomeDirectory() {
  if (myHomePath == null) {
    return null;
  }
  return StandardFileSystems.local().findFileByPath(myHomePath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ProjectJdkImpl.java


示例14: collectJarFiles

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
public static void collectJarFiles(final VirtualFile dir, final List<VirtualFile> container, final boolean recursively) {
  VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor(SKIP_ROOT, recursively ? null : ONE_LEVEL_DEEP) {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      final VirtualFile jarRoot = file.isDirectory() ? null : StandardFileSystems.getJarRootForLocalFile(file);
      if (jarRoot != null) {
        container.add(jarRoot);
        return false;
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LibraryImpl.java


示例15: fun

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Override
public VirtualFile fun(String s) {
  final FileType fileType = FileTypeRegistry.getInstance().getFileTypeByFileName(s);
  final VirtualFile localFile = PATH_TO_LOCAL_VFILE.fun(s);
  if (localFile == null) return null;

  if (ArchiveFileType.INSTANCE.equals(fileType) && !localFile.isDirectory()) {
    return StandardFileSystems.getJarRootForLocalFile(localFile);
  }
  return localFile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PathsList.java


示例16: findLocalFileByPath

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Nullable
public static VirtualFile findLocalFileByPath(String path) {
  VirtualFile result = StandardFileSystems.local().findFileByPath(path);
  if (result != null) return result;

  return !ApplicationManager.getApplication().isReadAccessAllowed()
         ? findLocalFileByPathUnderWriteAction(path)
         : findLocalFileByPathUnderReadAction(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ExternalSystemUtil.java


示例17: findLocalFileByPathUnderWriteAction

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Nullable
private static VirtualFile findLocalFileByPathUnderWriteAction(final String path) {
  return doWriteAction(new Computable<VirtualFile>() {
    @Override
    public VirtualFile compute() {
      return StandardFileSystems.local().refreshAndFindFileByPath(path);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ExternalSystemUtil.java


示例18: findLocalFileByPathUnderReadAction

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Nullable
private static VirtualFile findLocalFileByPathUnderReadAction(final String path) {
  return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
    @Override
    public VirtualFile compute() {
      return StandardFileSystems.local().findFileByPath(path);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ExternalSystemUtil.java


示例19: parseUrl

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
@Nullable
private static Url parseUrl(@NotNull CharSequence url) {
  CharSequence urlToParse;
  if (StringUtil.startsWith(url, "jar:file://")) {
    urlToParse = url.subSequence("jar:".length(), url.length());
  }
  else {
    urlToParse = url;
  }

  Matcher matcher = URI_PATTERN.matcher(urlToParse);
  if (!matcher.matches()) {
    return null;
  }
  String scheme = matcher.group(1);
  if (urlToParse != url) {
    scheme = "jar:" + scheme;
  }

  String authority = StringUtil.nullize(matcher.group(3));
  String path = StringUtil.nullize(matcher.group(4));
  boolean hasUrlSeparator = !StringUtil.isEmpty(matcher.group(2));
  if (authority == null) {
    if (hasUrlSeparator) {
      authority = "";
    }
  }
  else if (StandardFileSystems.FILE_PROTOCOL.equals(scheme) || !hasUrlSeparator) {
    path = path == null ? authority : (authority + path);
    authority = hasUrlSeparator ? "" : null;
  }

  // canonicalize only if authority is not empty or file url - we should not canonicalize URL with unknown scheme (webpack:///./modules/flux-orion-plugin/fluxPlugin.ts)
  if (path != null && (!StringUtil.isEmpty(authority) || StandardFileSystems.FILE_PROTOCOL.equals(scheme))) {
    path = FileUtil.toCanonicalUriPath(path);
  }
  return new UrlImpl(scheme, authority, path, matcher.group(5));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:Urls.java


示例20: updateBinarySkeletonsPath

import com.intellij.openapi.vfs.StandardFileSystems; //导入依赖的package包/类
/**
 * Updates binary skeletons path in the Python SDK table.
 */
private static void updateBinarySkeletonsPath(@NotNull PySdkUpdater sdkUpdater) {
  final String skeletonsPath = PythonSdkType.getSkeletonsPath(PathManager.getSystemPath(), sdkUpdater.getHomePath());
  if (skeletonsPath != null) {
    final VirtualFile skeletonsDir = StandardFileSystems.local().refreshAndFindFileByPath(skeletonsPath);
    if (skeletonsDir != null) {
      updateSkeletonsPath(sdkUpdater, skeletonsDir, PythonSdkType.SKELETON_DIR_NAME, "Binary skeletons");
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PythonSdkUpdater.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockBurnEvent类代码示例发布时间:2022-05-22
下一篇:
Java ControlTouchEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap