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

Java VirtualFilePointer类代码示例

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

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



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

示例1: getExcludeRootsForModule

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@NotNull
@Override
public VirtualFilePointer[] getExcludeRootsForModule(@NotNull final ModuleRootModel rootModel) {
  ArrayList<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>();
  final CompilerModuleExtension extension = rootModel.getModuleExtension(CompilerModuleExtension.class);
  if (extension == null) {
    return VirtualFilePointer.EMPTY_ARRAY;
  }
  if (extension.isCompilerOutputPathInherited()) {
    ContainerUtil.addIfNotNull(result, CompilerProjectExtension.getInstance(myProject).getCompilerOutputPointer());
  }
  else {
    if (!extension.isExcludeOutput()) return VirtualFilePointer.EMPTY_ARRAY;
    ContainerUtil.addIfNotNull(result, extension.getCompilerOutputPointer());
    ContainerUtil.addIfNotNull(result, extension.getCompilerOutputForTestsPointer());
  }
  return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExcludeCompilerOutputPolicy.java


示例2: getFiles

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
  final VirtualFilePointerContainer container = myRoots.get(rootType);
  if (container == null) return VirtualFile.EMPTY_ARRAY;
  final List<VirtualFile> expanded = new ArrayList<VirtualFile>();
  for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) {
    final VirtualFilePointer pointer = container.findByUrl(root.getUrl());
    if (pointer == null) continue;
    VirtualFile file = pointer.getFile();
    if (file == null) continue;

    if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) {
      LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY);
      continue;
    }
    expanded.add(file);
  }
  return VfsUtilCore.toVirtualFileArray(expanded);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JpsLibraryDelegate.java


示例3: getInvalidRootUrls

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Override
public List<String> getInvalidRootUrls(OrderRootType type) {
  final VirtualFilePointerContainer container = myRoots.get(type);
  if (container == null) return Collections.emptyList();
  final List<VirtualFilePointer> pointers = container.getList();
  List<String> invalidPaths = null;
  for (VirtualFilePointer pointer : pointers) {
    if (!pointer.isValid()) {
      if (invalidPaths == null) {
        invalidPaths = new SmartList<String>();
      }
      invalidPaths.add(pointer.getUrl());
    }
  }
  return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JpsLibraryDelegate.java


示例4: getAssociationsFor

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public PsiFile[] getAssociationsFor(PsiFile file, FileType... fileTypes) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return PsiFile.EMPTY_ARRAY;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.isValid() && pointer.getUrl().equals(virtualFile.getUrl())) {
      final VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        final VirtualFile[] files = container.getFiles();
        final Set<PsiFile> list = new HashSet<PsiFile>();
        final PsiManager psiManager = PsiManager.getInstance(myProject);
        for (VirtualFile assoc : files) {
          final PsiFile psiFile = psiManager.findFile(assoc);
          if (psiFile != null && (fileTypes.length == 0 || matchesFileType(psiFile, fileTypes))) {
            list.add(psiFile);
          }
        }
        return PsiUtilCore.toPsiFileArray(list);
      }
      else {
        return PsiFile.EMPTY_ARRAY;
      }
    }
  }
  return PsiFile.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FileAssociationsManagerImpl.java


示例5: getInvalidRootUrls

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Override
public List<String> getInvalidRootUrls(OrderRootType type) {
  if (myDisposed) return Collections.emptyList();

  final List<VirtualFilePointer> pointers = myRoots.get(type).getList();
  List<String> invalidPaths = null;
  for (VirtualFilePointer pointer : pointers) {
    if (!pointer.isValid()) {
      if (invalidPaths == null) {
        invalidPaths = new SmartList<String>();
      }
      invalidPaths.add(pointer.getUrl());
    }
  }
  return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LibraryImpl.java


示例6: removeRoot

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Override
public boolean removeRoot(@NotNull String url, @NotNull OrderRootType rootType) {
  checkDisposed();
  LOG.assertTrue(isWritable());

  final VirtualFilePointerContainer container = myRoots.get(rootType);
  final VirtualFilePointer byUrl = container.findByUrl(url);
  if (byUrl != null) {
    container.remove(byUrl);
    if (myExcludedRoots != null) {
      for (String excludedRoot : myExcludedRoots.getUrls()) {
        if (!isUnderRoots(excludedRoot)) {
          VirtualFilePointer pointer = myExcludedRoots.findByUrl(excludedRoot);
          if (pointer != null) {
            myExcludedRoots.remove(pointer);
          }
        }
      }
    }
    myJarDirectories.remove(rootType, url);
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LibraryImpl.java


示例7: testCreate

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public void testCreate() throws Exception {
  final File tempDirectory = createTempDirectory();
  final File fileToCreate = new File(tempDirectory, "toCreate.txt");
  final LoggingListener fileToCreateListener = new LoggingListener();
  final VirtualFilePointer fileToCreatePointer = createPointerByFile(fileToCreate, fileToCreateListener);
  assertFalse(fileToCreatePointer.isValid());
  fileToCreate.createNewFile();
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      VirtualFileManager.getInstance().syncRefresh();
      final VirtualFile virtualFile = getVirtualFile(tempDirectory);
      virtualFile.refresh(false, true);
    }
  });
  assertTrue(fileToCreatePointer.isValid());
  assertEquals("[before:false, after:true]", fileToCreateListener.getLog().toString());
  try {
    String expectedUrl = VirtualFileManager
      .constructUrl(LocalFileSystem.PROTOCOL, fileToCreate.getCanonicalPath().replace(File.separatorChar, '/'));
    assertEquals(expectedUrl.toUpperCase(), fileToCreatePointer.getUrl().toUpperCase());
  }
  catch (IOException e) {
    fail();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:VirtualFilePointerTest.java


示例8: checkFileName

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
private void checkFileName(String prefix, String suffix) throws IOException {
  final File tempDirectory = createTempDirectory();

  final VirtualFile temp = getVirtualFile(tempDirectory);
  String name = "toCreate.txt";
  final VirtualFilePointer fileToCreatePointer = createPointerByFile(new File(tempDirectory.getPath() + prefix + name +suffix), null);
  assertFalse(fileToCreatePointer.isValid());
  assertNull(fileToCreatePointer.getFile());

  VirtualFile child = createChildData(temp, name);

  assertTrue(fileToCreatePointer.isValid());
  assertEquals(child, fileToCreatePointer.getFile());

  delete(child);
  assertFalse(fileToCreatePointer.isValid());
  assertNull(fileToCreatePointer.getFile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:VirtualFilePointerTest.java


示例9: testTwoPointersBecomeOneAfterFileRenamedUnderTheOtherName

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public void testTwoPointersBecomeOneAfterFileRenamedUnderTheOtherName() throws IOException {
  final File tempDir = createTempDirectory();
  final File f1 = new File(tempDir, "f1");
  boolean created = f1.createNewFile();
  assertTrue(created);

  final String url1 = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, f1.getCanonicalPath().replace(File.separatorChar, '/'));
  final VirtualFile vFile1 = refreshAndFind(url1);

  final LoggingListener listener1 = new LoggingListener();
  VirtualFilePointer pointer1 = myVirtualFilePointerManager.create(url1, disposable, listener1);
  assertTrue(pointer1.isValid());
  String url2 = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, tempDir.getCanonicalPath().replace(File.separatorChar, '/')+"/f2");
  final LoggingListener listener2 = new LoggingListener();
  VirtualFilePointer pointer2 = myVirtualFilePointerManager.create(url2, disposable, listener2);
  assertFalse(pointer2.isValid());

  rename(vFile1, "f2");

  assertTrue(pointer1.isValid());
  assertTrue(pointer2.isValid());

  assertEquals("[]", listener1.getLog().toString());
  assertEquals("[before:false, after:true]", listener2.getLog().toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:VirtualFilePointerTest.java


示例10: testMultipleNotifications

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public void testMultipleNotifications() throws Exception {
  final File tempDir = createTempDirectory();
  final File file_f1 = new File(tempDir, "f1");
  final File file_f2 = new File(tempDir, "f2");
  final LoggingListener listener = new LoggingListener();
  final VirtualFilePointer pointer_f1 = createPointerByFile(file_f1, listener);
  final VirtualFilePointer pointer_f2 = createPointerByFile(file_f2, listener);
  assertFalse(pointer_f1.isValid());
  assertFalse(pointer_f2.isValid());
  file_f1.createNewFile();
  file_f2.createNewFile();
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      LocalFileSystem.getInstance().refresh(false);
    }
  });
  assertEquals("[before:false:false, after:true:true]", listener.getLog().toString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:VirtualFilePointerTest.java


示例11: MyDiffRequestChain

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public MyDiffRequestChain(@Nullable Project project,
                          @NotNull Iterable<Pair<VirtualFilePointer, FileStatus>> iterable,
                          @NotNull Label before,
                          @NotNull Label after,
                          @Nullable String selectedUrl) {
  myProject = project;
  myBefore = before;
  myAfter = after;

  int selected = -1;
  for (Pair<VirtualFilePointer, FileStatus> pair : iterable) {
    if (selected == -1 && pair.first.getUrl().equals(selectedUrl)) selected = myRequests.size();
    myRequests.add(new MyDiffRequestProducer(pair.first, pair.second));
  }
  if (selected != -1) myIndex = selected;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ShowUpdatedDiffAction.java


示例12: acceptFilter

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Override
protected boolean acceptFilter(Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
  try {
    VirtualFilePointer filePointer = getFilePointer();
    if (!filePointer.isValid()) {
      return false;
    }
    VirtualFile file = filePointer.getFile();
    if (file != null && file.isValid() && filter.first.contains(file, getProject(), filter.second)) {
      applyFilter(true);
      return true;
    }
  }
  catch (Throwable e) {
    // TODO: catch and ignore exceptions: see to FilePatternPackageSet
    // sometimes for new file DirectoryFileIndex.getContentRootForFile() return random path
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileTreeNode.java


示例13: beforeValidityChanged

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Override
public void beforeValidityChanged(@NotNull VirtualFilePointer[] pointers) {
  if (!myProject.isDisposed()) {
    if (myInsideRefresh == 0) {
      if (affectsRoots(pointers)) {
        beforeRootsChange(false);
        if (myDoLogCachesUpdate) LOG.info(new Throwable(pointers.length > 0 ? pointers[0].getPresentableUrl():""));
      }
    }
    else if (!myPointerChangesDetected) {
      //this is the first pointer changing validity
      if (affectsRoots(pointers)) {
        myPointerChangesDetected = true;
        myProject.getMessageBus().syncPublisher(ProjectTopics.PROJECT_ROOTS).beforeRootsChange(new ModuleRootEventImpl(myProject, false));
        if (myDoLogCachesUpdate) LOG.info(new Throwable(pointers.length > 0 ? pointers[0].getPresentableUrl():""));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ProjectRootManagerComponent.java


示例14: removeAssociation

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public void removeAssociation(PsiFile file, PsiFile assoc) {
  final VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return;
  if (assoc.getVirtualFile() == null) return;

  for (VirtualFilePointer pointer : myAssociations.keySet()) {
    if (pointer.getUrl().equals(virtualFile.getUrl())) {
      VirtualFilePointerContainer container = myAssociations.get(pointer);
      if (container != null) {
        //noinspection ConstantConditions
        final VirtualFilePointer p = container.findByUrl(assoc.getVirtualFile().getUrl());
        if (p != null) {
          container.remove(p);
          if (container.size() == 0) {
            myAssociations.remove(pointer);
          }
          touch();
        }
      }
      return;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FileAssociationsManagerImpl.java


示例15: getOutputPathValue

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Nullable
protected VirtualFilePointer getOutputPathValue(Element element, String tag, final boolean createPointer) {
  final Element outputPathChild = element.getChild(tag);
  VirtualFilePointer vptr = null;
  if (outputPathChild != null && createPointer) {
    String outputPath = outputPathChild.getAttributeValue(ATTRIBUTE_URL);
    vptr = createPointer(outputPath);
  }
  return vptr;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CompilerModuleExtensionImpl.java


示例16: getExcludeFolderUrls

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@NotNull
@Override
public List<String> getExcludeFolderUrls() {
  List<String> excluded = new ArrayList<String>();
  for (JpsExcludeFolder folder : myExcludeFolders) {
    excluded.add(folder.getUrl());
  }
  for (DirectoryIndexExcludePolicy excludePolicy : Extensions
    .getExtensions(DirectoryIndexExcludePolicy.EP_NAME, myRootModel.getProject())) {
    for (VirtualFilePointer pointer : excludePolicy.getExcludeRootsForModule(myRootModel)) {
      excluded.add(pointer.getUrl());
    }
  }
  return excluded;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JpsContentEntry.java


示例17: getExcludeFolderFiles

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile[] getExcludeFolderFiles() {
  List<VirtualFile> excluded = new ArrayList<VirtualFile>();
  for (JpsExcludeFolder folder : myExcludeFolders) {
    ContainerUtil.addIfNotNull(excluded, folder.getFile());
  }
  for (DirectoryIndexExcludePolicy excludePolicy : Extensions.getExtensions(DirectoryIndexExcludePolicy.EP_NAME, myRootModel.getProject())) {
    for (VirtualFilePointer pointer : excludePolicy.getExcludeRootsForModule(myRootModel)) {
      ContainerUtil.addIfNotNull(excluded, pointer.getFile());
    }
  }
  return VfsUtilCore.toVirtualFileArray(excluded);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JpsContentEntry.java


示例18: copy

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
private static HashMap<VirtualFilePointer, VirtualFilePointerContainer> copy(FileAssociationsManagerImpl other) {
  final HashMap<VirtualFilePointer, VirtualFilePointerContainer> hashMap = new LinkedHashMap<VirtualFilePointer, VirtualFilePointerContainer>();

  final Set<VirtualFilePointer> virtualFilePointers = other.myAssociations.keySet();
  for (VirtualFilePointer pointer : virtualFilePointers) {
    final VirtualFilePointerContainer container = other.myFilePointerManager.createContainer(other.myProject);
    container.addAll(other.myAssociations.get(pointer));
    hashMap.put(other.myFilePointerManager.duplicate(pointer, other.myProject, null), container);
  }
  return hashMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileAssociationsManagerImpl.java


示例19: removeExcludedRoot

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
@Override
public boolean removeExcludedRoot(@NotNull String url) {
  if (myExcludedRoots != null) {
    VirtualFilePointer pointer = myExcludedRoots.findByUrl(url);
    if (pointer != null) {
      myExcludedRoots.remove(pointer);
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:LibraryImpl.java


示例20: getAssociations

import com.intellij.openapi.vfs.pointers.VirtualFilePointer; //导入依赖的package包/类
public Map<VirtualFile, VirtualFile[]> getAssociations() {
  final HashMap<VirtualFile, VirtualFile[]> map = new LinkedHashMap<VirtualFile, VirtualFile[]>();
  final Set<VirtualFilePointer> set = myAssociations.keySet();
  for (VirtualFilePointer pointer : set) {
    if (pointer.isValid()) {
      final VirtualFile file = pointer.getFile();
      map.put(file, myAssociations.get(pointer).getFiles());
    }
  }
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileAssociationsManagerImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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