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


Java ArchiveVfsUtil类代码示例

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


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


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