本文整理汇总了Java中consulo.vfs.util.ArchiveVfsUtil.getJarRootForLocalFile方法的典型用法代码示例。如果您正苦于以下问题:Java ArchiveVfsUtil.getJarRootForLocalFile方法的具体用法?Java ArchiveVfsUtil.getJarRootForLocalFile怎么用?Java ArchiveVfsUtil.getJarRootForLocalFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类consulo.vfs.util.ArchiveVfsUtil
的用法示例。
在下文中一共展示了ArchiveVfsUtil.getJarRootForLocalFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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");
}
示例2: 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;
}
示例3: getJarFromLibDirectory
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
private static VirtualFile getJarFromLibDirectory(final String relativePath) {
final File file = PathManager.findFileInLibDirectory(relativePath);
final VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);
Assert.assertNotNull(file.getAbsolutePath() + " not found", virtualFile);
final VirtualFile jarRoot = ArchiveVfsUtil.getJarRootForLocalFile(virtualFile);
Assert.assertNotNull(jarRoot);
return jarRoot;
}
示例4: getJarFromLibDir
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
protected VirtualFile getJarFromLibDir(final String name) {
final VirtualFile file = getVirtualFile(PathManager.findFileInLibDirectory(name));
assertNotNull(name + " not found", file);
final VirtualFile jarFile = ArchiveVfsUtil.getJarRootForLocalFile(file);
assertNotNull(name + " is not jar", jarFile);
return jarFile;
}
示例5: isValidXalanPresent
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
@Nullable
private static Boolean isValidXalanPresent(SimpleJavaParameters parameters)
{
final List<VirtualFile> files = parameters.getClassPath().getVirtualFiles();
for(VirtualFile file : files)
{
if(file.getName().matches(".*xalan.*\\.jar"))
{
final VirtualFile root = ArchiveVfsUtil.getJarRootForLocalFile(file);
final VirtualFile manifestFile = root != null ? root.findFileByRelativePath("META-INF/MANIFEST.MF") : null;
if(manifestFile != null)
{
try
{
Manifest manifest = manifestFile.getUserData(MANIFEST);
if(manifest == null)
{
manifest = new Manifest(manifestFile.getInputStream());
manifestFile.putUserData(MANIFEST, manifest);
}
Attributes attributes = manifest.getAttributes("org/apache/xalan/");
if(attributes == null)
{
attributes = manifest.getAttributes("org/apache/xalan");
}
if(attributes == null)
{
LOG.info("No manifest attributes for 'org/apache/xalan/' in " + manifestFile.getPresentableUrl());
continue;
}
final String version = attributes.getValue("Implementation-Version");
if(version != null)
{
final String[] parts = version.split("\\.");
if(parts.length >= 2)
{
if(Integer.parseInt(parts[0]) >= 2 && Integer.parseInt(parts[1]) >= 6)
{
return true;
}
}
LOG.info("Unsupported Xalan version: " + version);
}
else
{
LOG.info("No Xalan version information in " + file.getPath());
}
}
catch(IOException e)
{
LOG.warn("Unable to read manifest from " + file.getName(), e);
}
}
else
{
LOG.info("No manifest file in " + file.getPath());
}
return false;
}
}
return null;
}