本文整理汇总了Java中consulo.vfs.util.ArchiveVfsUtil.getVirtualFileForArchive方法的典型用法代码示例。如果您正苦于以下问题:Java ArchiveVfsUtil.getVirtualFileForArchive方法的具体用法?Java ArchiveVfsUtil.getVirtualFileForArchive怎么用?Java ArchiveVfsUtil.getVirtualFileForArchive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类consulo.vfs.util.ArchiveVfsUtil
的用法示例。
在下文中一共展示了ArchiveVfsUtil.getVirtualFileForArchive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
}
示例4: 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();
}
示例5: 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());
}
示例6: 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;
}
示例7: 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;
}
示例8: 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);
}
示例9: 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);
}
示例10: 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());
}
示例11: getNodeName
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
@Nonnull
@RequiredReadAction
public static String getNodeName(ViewSettings settings, Object parentValue, @Nonnull PsiDirectory directory) {
Project project = directory.getProject();
PsiPackage aPackage = PsiPackageManager.getInstance(project).findAnyPackage(directory);
String name = directory.getName();
VirtualFile dirFile = directory.getVirtualFile();
if (dirFile.getFileSystem() instanceof ArchiveFileSystem && dirFile.getParent() == null) {
VirtualFile virtualFileForArchive = ArchiveVfsUtil.getVirtualFileForArchive(dirFile);
if (virtualFileForArchive != null) {
name = virtualFileForArchive.getName();
}
}
PsiPackage parentPackage;
if (!ProjectRootsUtil.isSourceRoot(directory) && aPackage != null && !aPackage.getQualifiedName().isEmpty() &&
parentValue instanceof PsiDirectory) {
parentPackage = PsiPackageManager.getInstance(project).findAnyPackage(((PsiDirectory)parentValue));
}
else if (ProjectRootsUtil.isSourceRoot(directory) && aPackage != null) { //package prefix
aPackage = null;
parentPackage = null;
}
else {
parentPackage = null;
}
return TreeViewUtil.getNodeName(settings, aPackage, parentPackage, name, isShowFQName(project, settings, parentValue, directory));
}
示例12: showLibraryLocation
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
private void showLibraryLocation(ProjectFileIndex fileIndex, VirtualFile vFile) {
setIcon(AllIcons.Nodes.PpLibFolder);
for (OrderEntry order : fileIndex.getOrderEntriesForFile(vFile)) {
if (order instanceof LibraryOrderEntry || order instanceof ModuleExtensionWithSdkOrderEntry) {
myText = getPresentableName(order, vFile);
break;
}
}
myText = myText.substring(myText.lastIndexOf(File.separatorChar) + 1);
VirtualFile archiveFile = ArchiveVfsUtil.getVirtualFileForArchive(vFile);
if (archiveFile != null && !myText.equals(archiveFile.getName())) {
myText += " (" + archiveFile.getName() + ")";
}
}
示例13: isRoot
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
public static boolean isRoot(@NotNull VirtualFile file)
{
if(file.getParent() == null)
{
VirtualFile archiveFile = ArchiveVfsUtil.getVirtualFileForArchive(file);
return archiveFile != null && archiveFile.getFileType() == JModFileType.INSTANCE;
}
return false;
}
示例14: isModuleDirectory
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
@RequiredReadAction
public static boolean isModuleDirectory(PsiDirectory directory)
{
String name = directory.getName();
if(name.equals("classes"))
{
VirtualFile archiveFile = ArchiveVfsUtil.getVirtualFileForArchive(directory.getVirtualFile());
return archiveFile != null && archiveFile.getFileType() == JModFileType.INSTANCE;
}
return false;
}
示例15: addNoJdkModFiles
import consulo.vfs.util.ArchiveVfsUtil; //导入方法依赖的package包/类
private static void addNoJdkModFiles(OrderRootsEnumerator orderEnumerator, PathsList pathsList)
{
for(VirtualFile virtualFile : orderEnumerator.getRoots())
{
VirtualFile archive = ArchiveVfsUtil.getVirtualFileForArchive(virtualFile);
if(archive != null && archive.getFileType() == JModFileType.INSTANCE)
{
continue;
}
pathsList.add(virtualFile);
}
}