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

Java NewVirtualFile类代码示例

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

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



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

示例1: markDirty

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@NotNull
public static List<VirtualFile> markDirty(boolean recursive, boolean reloadChildren, @NotNull VirtualFile... files) {
  List<VirtualFile> list = ContainerUtil.filter(Condition.NOT_NULL, files);
  if (list.isEmpty()) {
    return Collections.emptyList();
  }

  for (VirtualFile file : list) {
    if (reloadChildren) {
      file.getChildren();
    }

    if (file instanceof NewVirtualFile) {
      if (recursive) {
        ((NewVirtualFile)file).markDirtyRecursively();
      }
      else {
        ((NewVirtualFile)file).markDirty();
      }
    }
  }
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:VfsUtil.java


示例2: isFileIgnored

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
boolean isFileIgnored(@NotNull VirtualFile file) {
  if (myVfsEventNesting != 0 || !(file instanceof NewVirtualFile)) {
    return isFileIgnoredNoCache(file);
  }

  int id = ((NewVirtualFile)file).getId();
  if (id < 0) {
    return isFileIgnoredNoCache(file);
  }

  ConcurrentBitSet checkedIds = myCheckedIds;
  if (checkedIds.get(id)) {
    return myIgnoredIds.containsKey(id);
  }

  boolean result = isFileIgnoredNoCache(file);
  if (result) {
    myIgnoredIds.put(id, Boolean.TRUE);
  }
  else {
    myIgnoredIds.remove(id);
  }
  checkedIds.set(id);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:IgnoredFileCache.java


示例3: scan

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public void scan() {
  NewVirtualFile root = myRefreshQueue.pullFirst().first;
  boolean rootDirty = root.isDirty();
  debug(LOG, "root=%s dirty=%b", root, rootDirty);
  if (!rootDirty) return;

  NewVirtualFileSystem fs = root.getFileSystem();
  FileAttributes rootAttributes = fs.getAttributes(root);
  if (rootAttributes == null) {
    scheduleDeletion(root);
    root.markClean();
    return;
  }
  else if (rootAttributes.isDirectory()) {
    fs = PersistentFS.replaceWithNativeFS(fs);
  }

  myRefreshQueue.addLast(pair(root, rootAttributes));
  try {
    processQueue(fs, PersistentFS.getInstance());
  }
  catch (RefreshCancelledException e) {
    LOG.debug("refresh cancelled");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:RefreshWorker.java


示例4: markSuspiciousFilesDirty

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public void markSuspiciousFilesDirty(List<VirtualFile> files) {
  storeRefreshStatusToFiles();

  if (myWatcher.isOperational()) {
    for (String root : myWatcher.getManualWatchRoots()) {
      final VirtualFile suspiciousRoot = findFileByPathIfCached(root);
      if (suspiciousRoot != null) {
        ((NewVirtualFile)suspiciousRoot).markDirtyRecursively();
      }
    }
  }
  else {
    for (VirtualFile file : files) {
      if (file.getFileSystem() == this) {
        ((NewVirtualFile)file).markDirtyRecursively();
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LocalFileSystemImpl.java


示例5: refreshWithoutFileWatcher

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@Override
public void refreshWithoutFileWatcher(final boolean asynchronous) {
  Runnable heavyRefresh = new Runnable() {
    @Override
    public void run() {
      for (VirtualFile root : myManagingFS.getRoots(LocalFileSystemImpl.this)) {
        ((NewVirtualFile)root).markDirtyRecursively();
      }

      refresh(asynchronous);
    }
  };

  if (asynchronous && myWatcher.isOperational()) {
    RefreshQueue.getInstance().refresh(true, true, heavyRefresh, myManagingFS.getRoots(this));
  }
  else {
    heavyRefresh.run();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LocalFileSystemImpl.java


示例6: refreshOpenFiles

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@Override
public void refreshOpenFiles() {
  List<VirtualFile> files = ContainerUtil.newArrayList();

  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    for (VirtualFile file : FileEditorManager.getInstance(project).getSelectedFiles()) {
      if (file instanceof NewVirtualFile) {
        files.add(file);
      }
    }
  }

  if (!files.isEmpty()) {
    // refresh open files synchronously so it doesn't wait for potentially longish refresh request in the queue to finish
    RefreshQueue.getInstance().refresh(false, false, null, files);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SaveAndSyncHandlerImpl.java


示例7: getFrameworkIdOfBuildFile

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@Nullable
public static String getFrameworkIdOfBuildFile(VirtualFile file) {
  if (file instanceof NewVirtualFile) {
    final DataInputStream is = FRAMEWORK_FILE_ATTRIBUTE.readAttribute(file);
    if (is != null) {
      try {
        try {
          if (is.available() == 0) {
            return null;
          }
          return IOUtil.readString(is);
        }
        finally {
          is.close();
        }
      }
      catch (IOException e) {
        LOG.error(file.getPath(), e);
      }
    }
    return "";
  }
  return file.getUserData(FRAMEWORK_FILE_MARKER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ForcedBuildFileAttribute.java


示例8: forceBuildFile

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
private static void forceBuildFile(VirtualFile file, @Nullable String value) {
  if (file instanceof NewVirtualFile) {
    final DataOutputStream os = FRAMEWORK_FILE_ATTRIBUTE.writeAttribute(file);
    try {
      try {
        IOUtil.writeString(StringUtil.notNullize(value), os);
      }
      finally {
        os.close();
      }
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }
  else {
    file.putUserData(FRAMEWORK_FILE_MARKER, value);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ForcedBuildFileAttribute.java


示例9: testFindRootPerformance

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public void testFindRootPerformance() throws IOException {
  File tempJar = IoTestUtil.createTestJar();
  final VirtualFile jar = refreshAndFindFile(tempJar);
  assertNotNull(jar);

  final JarFileSystem fs = JarFileSystem.getInstance();
  final String path = jar.getPath() + "!/";
  final NewVirtualFile root = ManagingFS.getInstance().findRoot(path, fs);
  PlatformTestUtil.startPerformanceTest("find root is slow", 5000, new ThrowableRunnable() {
    @Override
    public void run() throws Throwable {
      JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Collections.nCopies(500, null), null, false, false, new Processor<Object>() {
        @Override
        public boolean process(Object o) {
          for (int i = 0; i < 20000; i++) {
            NewVirtualFile rootJar = ManagingFS.getInstance().findRoot(path, fs);
            assertNotNull(rootJar);
            assertSame(root, rootJar);
          }
          return true;
        }
      });
    }
  }).assertTiming();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:VfsUtilPerformanceTest.java


示例10: addFileToDelete

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
private void addFileToDelete(VirtualFile file) {
  if (file.isDirectory() && file instanceof NewVirtualFile && !isDirectoryVersioningSupported()) {
    for (VirtualFile child : ((NewVirtualFile)file).getCachedChildren()) {
      addFileToDelete(child);
    }
  }
  else {
    final VcsDeleteType type = needConfirmDeletion(file);
    final FilePath filePath =
      VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(new File(file.getPath()), file.isDirectory());
    if (type == VcsDeleteType.CONFIRM) {
      myDeletedFiles.add(filePath);
    }
    else if (type == VcsDeleteType.SILENT) {
      myDeletedWithoutConfirmFiles.add(filePath);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:VcsVFSListener.java


示例11: actionPerformed

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = getEventProject(e);
  final VirtualFile[] files = getFiles(e);
  if (project == null || files == null || files.length == 0) return;

  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      for (VirtualFile file : files) {
        if (file instanceof NewVirtualFile) {
          ((NewVirtualFile)file).markDirtyRecursively();
        }
      }
    }
  });

  RefreshQueue.getInstance().refresh(true, true, new Runnable() {
    @Override
    public void run() {
      postRefresh(project, files);
    }
  }, files);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SynchronizeCurrentFileAction.java


示例12: processFile

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public boolean processFile(NewVirtualFile file) {
  if (file.isDirectory() || file.is(VFileProperty.SPECIAL)) {
    return true;
  }
  try {
    DataInputStream stream = FSRecords.readContent(file.getId());
    if (stream == null) return true;
    byte[] bytes = FileUtil.loadBytes(stream);
    totalSize.addAndGet(bytes.length);
    count.incrementAndGet();
    ProgressManager.getInstance().getProgressIndicator().setText(file.getPresentableUrl());
  }
  catch (IOException e) {
    LOG.error(e);
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LoadAllVfsStoredContentsAction.java


示例13: isAntFileOld

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
private static boolean isAntFileOld(VirtualFile file) {
  if (file instanceof NewVirtualFile) {
    final DataInputStream is = ourAttribute.readAttribute(file);
    if (is != null) {
      try {
        try {
          return is.readBoolean();
        }
        finally {
          is.close();
        }
      }
      catch (IOException e) {
        LOG.error(e);
      }
    }
    return false;
  }
  return Boolean.TRUE.equals(file.getUserData(ourAntFileMarker));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ForcedAntFileAttribute.java


示例14: visitFile

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@Override
public boolean visitFile(VirtualFile file) {
    file.putUserData(MODIFICATION_DATE_KEY, null);
    if(file instanceof NewVirtualFile) {
        final DataOutputStream os = MODIFICATION_STAMP_FILE_ATTRIBUTE.writeAttribute(file);
        try {
            try {
                IOUtil.writeString(StringUtil.notNullize("0"), os);
            } finally {
                os.close();
            }
        } catch(IOException e) {
            // Ignore it but we might need to throw an exception
            String message = e.getMessage();
        }
    }
    return recursive;
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:19,代码来源:Util.java


示例15: setModificationStamp

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public static void setModificationStamp(VirtualFile file) {
    // Store it in memory first
    if(file != null) {
        file.putUserData(Util.MODIFICATION_DATE_KEY, file.getTimeStamp());
        if(file instanceof NewVirtualFile) {
            final DataOutputStream os = MODIFICATION_STAMP_FILE_ATTRIBUTE.writeAttribute(file);
            try {
                try {
                    IOUtil.writeString(StringUtil.notNullize(file.getTimeStamp() + ""), os);
                } finally {
                    os.close();
                }
            } catch(IOException e) {
                // Ignore it but we might need to throw an exception
                String message = e.getMessage();
            }
        }
    }
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:20,代码来源:Util.java


示例16: markDirty

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
@NotNull
public static List<VirtualFile> markDirty(boolean recursive, boolean reloadChildren, VirtualFile... files) {
  List<VirtualFile> list = ContainerUtil.filter(Condition.NOT_NULL, files);
  if (list.isEmpty()) {
    return Collections.emptyList();
  }

  for (VirtualFile file : list) {
    if (reloadChildren) {
      file.getChildren();
    }

    if (file instanceof NewVirtualFile) {
      if (recursive) {
        ((NewVirtualFile)file).markDirtyRecursively();
      }
      else {
        ((NewVirtualFile)file).markDirty();
      }
    }
  }
  return list;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:VfsUtil.java


示例17: refreshOpenFiles

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public static void refreshOpenFiles() {
  List<VirtualFile> files = ContainerUtil.newArrayList();
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    VirtualFile[] projectFiles = FileEditorManager.getInstance(project).getSelectedFiles();
    for (VirtualFile file : projectFiles) {
      if (file instanceof NewVirtualFile) {
        files.add(file);
      }
    }
  }

  if (!files.isEmpty()) {
    // refresh open files synchronously so it doesn't wait for potentially longish refresh request in the queue to finish
    RefreshQueue.getInstance().refresh(false, false, null, files);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:SaveAndSyncHandlerImpl.java


示例18: testFindRootWithDenormalizedPath

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public void testFindRootWithDenormalizedPath() {
  File tempDir = new WriteAction<File>() {
    @Override
    protected void run(Result<File> result) throws Throwable {
      File res = createTempDirectory();
      new File(res, "x.jar").createNewFile();
      result.setResult(res);
    }
  }.execute().getResultObject();
  VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDir);
  VirtualFile jar = vDir.findChild("x.jar");
  assertNotNull(jar);

  NewVirtualFile root1 = ManagingFS.getInstance().findRoot(jar.getPath()+"!/", JarFileSystem.getInstance());
  NewVirtualFile root2 = ManagingFS.getInstance().findRoot(jar.getParent().getPath() + "//"+ jar.getName()+"!/", JarFileSystem.getInstance());
  assertNotNull(root1);
  assertSame(root1, root2);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:VfsUtilTest.java


示例19: testListChildrenOfTheRootOfTheRoot

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的package包/类
public void testListChildrenOfTheRootOfTheRoot() {
  PersistentFS fs = PersistentFS.getInstance();
  NewVirtualFile fakeRoot = fs.findRoot("", LocalFileSystem.getInstance());
  assertNotNull(fakeRoot);
  int users = fs.getId(fakeRoot, "Users", LocalFileSystem.getInstance());
  assertEquals(0, users);
  users = fs.getId(fakeRoot, "usr", LocalFileSystem.getInstance());
  assertEquals(0, users);
  int win = fs.getId(fakeRoot, "Windows", LocalFileSystem.getInstance());
  assertEquals(0, win);

  VirtualFile[] roots = fs.getRoots(LocalFileSystem.getInstance());
  for (VirtualFile root : roots) {
    int rid = fs.getId(fakeRoot, root.getName(), LocalFileSystem.getInstance());
    assertTrue(root.getPath()+"; Roots:"+ Arrays.toString(roots), 0 != rid);
  }

  NewVirtualFile c = fakeRoot.refreshAndFindChild("Users");
  assertNull(c);
  c = fakeRoot.refreshAndFindChild("Users");
  assertNull(c);
  c = fakeRoot.refreshAndFindChild("Windows");
  assertNull(c);
  c = fakeRoot.refreshAndFindChild("Windows");
  assertNull(c);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:PersistentFSTest.java


示例20: testFindRootShouldNotBeFooledByRelativePath

import com.intellij.openapi.vfs.newvfs.NewVirtualFile; //导入依赖的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);
  JarFileSystem jfs = JarFileSystem.getInstance();
  VirtualFile root = jfs.getJarRootForLocalFile(vx);

  PersistentFS fs = PersistentFS.getInstance();

  String path = vx.getPath() + "/../" + vx.getName() + JarFileSystem.JAR_SEPARATOR;
  NewVirtualFile root1 = fs.findRoot(path, jfs);

  assertSame(root1, root);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:PersistentFSTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java BasicCredentialMetaData类代码示例发布时间:2022-05-23
下一篇:
Java Selector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap