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

Java ArchiveVfsUtil类代码示例

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

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



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

示例1: createSdk

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Override
protected Sdk createSdk(VirtualFile virtualFile)
{
	SdkImpl sdk = new SdkImpl("Mono IKVM.NET", IkvmBundleType.getInstance());
	VirtualFile mainMonoPath = virtualFile.getParent().getParent().getParent();
	sdk.setHomePath(mainMonoPath.getPath());
	sdk.setPredefined(true);
	sdk.setVersionString(IkvmBundleType.getInstance().getVersionString(sdk));

	SdkModificator sdkModificator = sdk.getSdkModificator();
	for(String library : IkvmBundleType.ourLibraries)
	{
		VirtualFile libraryFile = mainMonoPath.findFileByRelativePath("lib/mono/ikvm/" + library);
		if(libraryFile != null)
		{
			VirtualFile archiveLibraryFile = ArchiveVfsUtil.getArchiveRootForLocalFile(libraryFile);
			if(archiveLibraryFile != null)
			{
				sdkModificator.addRoot(archiveLibraryFile, BinariesOrderRootType.getInstance());
			}
		}
	}

	sdkModificator.commitChanges();
	return sdk;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:27,代码来源:MonoIkvmModuleExtension.java


示例2: resolve

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@NotNull
@RequiredReadAction
static AssemblyModule resolve(@NotNull PsiElement element)
{
	Module module = ModuleUtilCore.findModuleForPsiElement(element);
	if(module != null)
	{
		return new ConsuloModuleAsAssemblyModule(module);
	}

	VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
	if(virtualFile != null)
	{
		VirtualFile rootFile = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile);
		if(rootFile != null && rootFile.getFileType() == DotNetModuleFileType.INSTANCE)
		{
			return new DotNetModuleAsAssemblyModule(element.getProject(), rootFile);
		}
	}
	return UnknownAssemblyModule.INSTANCE;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:22,代码来源:AssemblyModule.java


示例3: loadProperties

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
public static Properties loadProperties(File antJar) throws IOException
{
	Properties properties = new Properties();

	VirtualFile fileByIoFile = LocalFileSystem.getInstance().findFileByIoFile(antJar);
	if(fileByIoFile == null)
	{
		return properties;
	}
	VirtualFile archiveRootForLocalFile = ArchiveVfsUtil.getArchiveRootForLocalFile(fileByIoFile);
	if(archiveRootForLocalFile == null)
	{
		return properties;
	}
	VirtualFile fileByRelativePath = archiveRootForLocalFile.findFileByRelativePath(VERSION_RESOURCE);
	if(fileByRelativePath == null)
	{
		return null;
	}
	properties.load(fileByRelativePath.getInputStream());

	return properties;
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:24,代码来源:AntVersionUtil.java


示例4: setupSdkPaths

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Override
public void setupSdkPaths(Sdk sdk)
{
	SdkModificator sdkModificator = sdk.getSdkModificator();
	VirtualFile homeDirectory = sdk.getHomeDirectory();
	VirtualFile lib = homeDirectory.findChild("lib");
	if(lib != null)
	{
		for(VirtualFile virtualFile : lib.getChildren())
		{
			VirtualFile archiveRootForLocalFile = ArchiveVfsUtil.getArchiveRootForLocalFile(virtualFile);
			if(archiveRootForLocalFile != null)
			{
				sdkModificator.addRoot(archiveRootForLocalFile, BinariesOrderRootType.getInstance());
			}
		}
	}
	sdkModificator.commitChanges();
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:20,代码来源:AntSdkType.java


示例5: get

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Override
public List<File> get(AbstractProperty.AbstractPropertyContainer container)
{
	List<File> classpath = new ArrayList<File>();
	collectClasspath(classpath, ADDITIONAL_CLASSPATH, container);
	Sdk antInstallation = ANT_INSTALLATION.get(container);
	if(antInstallation != null)
	{
		VirtualFile[] virtualFiles = antInstallation.getRootProvider().getFiles(BinariesOrderRootType.getInstance());
		for(VirtualFile virtualFile : virtualFiles)
		{
			VirtualFile localFile = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile);
			if(localFile != null)
			{
				classpath.add(VfsUtil.virtualToIoFile(localFile));
			}
		}
	}

	return classpath;
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:22,代码来源:AntBuildFileImpl.java


示例6: resolveHolder

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@NotNull
public ExternalAttributeHolder resolveHolder(@NotNull VirtualFile virtualFile)
{
	VirtualFile localFile = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile);
	if(localFile == null)
	{
		return ExternalAttributeHolder.EMPTY;
	}

	ExternalAttributeHolder externalAttributeHolder = myCache.get(localFile);
	if(externalAttributeHolder == null)
	{
		myCache.put(localFile, externalAttributeHolder = resolveHolderImpl(virtualFile, localFile));
		return externalAttributeHolder;
	}
	else
	{
		return externalAttributeHolder;
	}
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:21,代码来源:ExternalAttributeManager.java


示例7: detectRoots

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@NotNull
@Override
public Collection<VirtualFile> detectRoots(@NotNull VirtualFile rootCandidate, @NotNull ProgressIndicator progressIndicator)
{
	if(rootCandidate.getFileSystem() instanceof ArchiveFileSystem)
	{
		VirtualFile localFile = ArchiveVfsUtil.getVirtualFileForArchive(rootCandidate);
		if(localFile == null || localFile.getFileType() != DotNetModuleFileType.INSTANCE)
		{
			return Collections.emptyList();
		}
		String docFilePath = localFile.getParent().getPath() + "/" + localFile.getNameWithoutExtension() + XmlFileType.DOT_DEFAULT_EXTENSION;
		VirtualFile docFile = LocalFileSystem.getInstance().findFileByIoFile(new File(docFilePath));
		if(docFile != null)
		{
			return Collections.singletonList(docFile);
		}
	}
	else if(rootCandidate.getFileType() == XmlFileType.INSTANCE)
	{
		return Collections.singletonList(rootCandidate);
	}
	return Collections.emptyList();
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:25,代码来源:DotNetXmlDocumentationRootDetector.java


示例8: testFindRootShouldNotBeFooledByRelativePath

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的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: getFileElementFor

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Nullable
private static FileElement getFileElementFor(@Nonnull VirtualFile file) {
  VirtualFile selectFile;

  if ((file.getFileSystem() instanceof ArchiveFileSystem) && file.getParent() == null) {
    selectFile = ArchiveVfsUtil.getVirtualFileForArchive(file);
    if (selectFile == null) {
      return null;
    }
  }
  else {
    selectFile = file;
  }

  return new FileElement(selectFile, selectFile.getName());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:FileSystemTreeImpl.java


示例10: isAccepted

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Override
public boolean isAccepted(@Nonnull VirtualFile rootCandidate, @Nonnull final ProgressIndicator progressIndicator) {
  if (isJarDirectory()) {
    if (!rootCandidate.isDirectory() || !rootCandidate.isInLocalFileSystem()) {
      return false;
    }
    for (VirtualFile child : rootCandidate.getChildren()) {
      if (!child.isDirectory() && child.getFileType() instanceof ArchiveFileType) {
        final VirtualFile archiveRoot = ArchiveVfsUtil.getArchiveRootForLocalFile(child);
        if (archiveRoot != null && containsFileOfType(archiveRoot, progressIndicator)) {
          return true;
        }
      }
    }
    return false;
  }
  else {
    return containsFileOfType(rootCandidate, progressIndicator);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:FileTypeBasedRootFilter.java


示例11: search

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
public void search() {
  myFiles.clear();
  myJars.clear();

  PsiManager psiManager = PsiManager.getInstance(myProject);
  for (PsiFile file : search(myModule, myProject)) {
    VirtualFile jar = ArchiveVfsUtil.getVirtualFileForJar(file.getVirtualFile());
    if (jar != null) {
      myJars.putValue(jar, file);
    }
    else {
      Module module = ModuleUtilCore.findModuleForPsiElement(file);
      if (module != null) {
        myFiles.putValue(module, file);
      }
      else {
        VirtualFile virtualFile = file.getVirtualFile();
        myVirtualFiles.putValue(virtualFile.getParent(), psiManager.findFile(virtualFile));
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:23,代码来源:ConfigFileSearcher.java


示例12: filterModFiles

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@NotNull
private static Set<VirtualFile> filterModFiles(Set<VirtualFile> files)
{
	Set<VirtualFile> newFiles = new LinkedHashSet<>(files.size());
	for(VirtualFile file : files)
	{
		VirtualFile archive = ArchiveVfsUtil.getVirtualFileForArchive(file);
		if(archive != null && archive.getFileType() == JModFileType.INSTANCE)
		{
			continue;
		}

		newFiles.add(file);
	}
	return newFiles;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:JavacCompiler.java


示例13: attachJdkAnnotations

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
public static boolean attachJdkAnnotations(@NotNull SdkModificator modificator)
{
	File pluginPath = PluginManager.getPluginPath(JavaSdkImpl.class);

	File file = new File(pluginPath, "jdk-annotations.jar");

	VirtualFile localFile = LocalFileSystem.getInstance().findFileByIoFile(file);

	if(localFile == null)
	{
		LOG.error("jdk annotations not found in: " + file);
		return false;
	}

	VirtualFile jarFile = ArchiveVfsUtil.getArchiveRootForLocalFile(localFile);
	if(jarFile == null)
	{
		LOG.error("jdk annotations is not archive: " + file);
		return false;
	}

	OrderRootType annoType = AnnotationOrderRootType.getInstance();
	modificator.removeRoot(jarFile, annoType);
	modificator.addRoot(jarFile, annoType);
	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:JavaSdkImpl.java


示例14: doTest

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
private void doTest(boolean annotateLocalVariables) throws Exception  {
  final String nullityPath = "/codeInsight/nullityinferrer";
  final VirtualFile aLib = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + nullityPath + "/lib/annotations.jar");
  if (aLib != null) {
    final VirtualFile file = ArchiveVfsUtil.getJarRootForLocalFile(aLib);
    if (file != null) {
      ModuleRootModificationUtil.addModuleLibrary(myModule, file.getUrl());
    }
  }

  configureByFile(nullityPath + "/before" + getTestName(false) + ".java");
  final NullityInferrer nullityInferrer = new NullityInferrer(annotateLocalVariables, getProject());
  nullityInferrer.collect(getFile());
  nullityInferrer.apply(getProject());
  checkResultByFile(nullityPath + "/after" + getTestName(false)+ ".java");
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:NullityInferrerTest.java


示例15: isIKVMLibrary

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@RequiredReadAction
private static boolean isIKVMLibrary(@NotNull DotNetTypeDeclaration typeDeclaration)
{
	VirtualFile virtualFile = PsiUtilCore.getVirtualFile(typeDeclaration);
	if(virtualFile == null)
	{
		return false;
	}
	VirtualFile virtualFileForArchive = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile);
	if(virtualFileForArchive == null)
	{
		return false;
	}

	List<OrderEntry> orderEntriesForFile = ProjectFileIndex.SERVICE.getInstance(typeDeclaration.getProject()).getOrderEntriesForFile
			(virtualFile);
	if(orderEntriesForFile.isEmpty())
	{
		return false;
	}
	for(OrderEntry orderEntry : orderEntriesForFile)
	{
		if(orderEntry instanceof ModuleExtensionWithSdkOrderEntry)
		{
			ModuleExtensionWithSdk<?> moduleExtension = ((ModuleExtensionWithSdkOrderEntry) orderEntry).getModuleExtension();
			if(moduleExtension instanceof IkvmModuleExtension)
			{
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:34,代码来源:StubBuilder.java


示例16: getBaseJarUrl

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@LuaMethod(name="getBaseJarUrl", global = true)
public String getBaseJarUrl() {
    String url = VfsUtil.pathToUrl(PathUtil.getJarPathForClass(LuaPsiFile.class));
    VirtualFile sdkFile = VirtualFileManager.getInstance().findFileByUrl(url);
    if (sdkFile != null) {
        VirtualFile jarFile = ArchiveVfsUtil.getJarRootForLocalFile(sdkFile);
        if (jarFile != null) {
            return jarFile.getUrl();
        } else {
            return sdkFile.getUrl();
        }
    }

    return null;
}
 
开发者ID:consulo,项目名称:consulo-lua,代码行数:16,代码来源:KahluaPluginDocumentationProvider.java


示例17: createClassLoader

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
private static ClassLoader createClassLoader(final String runClasspath, final String moduleName) {
  final ArrayList<URL> urls = new ArrayList<URL>();
  final VirtualFileManager manager = VirtualFileManager.getInstance();
  final StringTokenizer tokenizer = new StringTokenizer(runClasspath, File.pathSeparator);
  while (tokenizer.hasMoreTokens()) {
    final String s = tokenizer.nextToken();
    try {
      VirtualFile vFile = manager.findFileByUrl(VfsUtil.pathToUrl(s));

      VirtualFile archiveFile = ArchiveVfsUtil.getVirtualFileForArchive(vFile);
      if(archiveFile != null) {
        urls.add(new File(archiveFile.getCanonicalPath()).toURI().toURL());
      }
      else {
        urls.add(new File(s).toURI().toURL());
      }
    }
    catch (Exception e) {
      // ignore ?
    }
  }

  try {
    urls.add(new File(PathUtil.getJarPathForClass(Spacer.class)).toURI().toURL());
  }
  catch (MalformedURLException ignored) {
    // ignore
  }

  return new DesignTimeClassLoader(urls, LoaderFactory.class.getClassLoader(), moduleName);
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:32,代码来源:LoaderFactory.java


示例18: buildClasspath

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Override
protected ClassLoader buildClasspath()
{
	final ArrayList<File> files = new ArrayList<File>();
	// ant installation jars
	VirtualFile[] virtualFiles = mySdk.getRootProvider().getFiles(BinariesOrderRootType.getInstance());
	for(VirtualFile virtualFile : virtualFiles)
	{
		VirtualFile localFile = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile);
		if(localFile != null)
		{
			files.add(VfsUtil.virtualToIoFile(localFile));
		}
	}

	// jars from user home
	files.addAll(AntBuildFileImpl.getUserHomeLibraries());

	final List<URL> urls = new ArrayList<URL>(files.size());
	for(File file : files)
	{
		try
		{
			urls.add(file.toURI().toURL());
		}
		catch(MalformedURLException e)
		{
			LOG.debug(e);
		}
	}
	return new AntResourcesClassLoader(urls, null, true, false);
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:33,代码来源:AntInstallationClassLoaderHolder.java


示例19: collectJarFiles

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的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(@Nonnull VirtualFile file) {
      final VirtualFile jarRoot = ArchiveVfsUtil.getArchiveRootForLocalFile(file);
      if (jarRoot != null) {
        container.add(jarRoot);
        return false;
      }
      return true;
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:LibraryImpl.java


示例20: getLocalFileSystemPath

import consulo.vfs.util.ArchiveVfsUtil; //导入依赖的package包/类
@Nonnull
public static String getLocalFileSystemPath(@Nonnull VirtualFile file) {
  final VirtualFile archiveRoot = ArchiveVfsUtil.getVirtualFileForArchive(file);
  if (archiveRoot != null) {
    return archiveRoot.getPath();
  }
  return toCanonicalPath(file.getPath());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:ExternalSystemApiUtil.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java MaterialAboutActionItem类代码示例发布时间:2022-05-22
下一篇:
Java Wrapper类代码示例发布时间: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