Java 类com.intellij.openapi.vfs.ex.VirtualFileManagerEx 实例源码

项目:intellij-ce-playground    文件:RefreshSessionImpl.java   
protected void fireEventsInWriteAction() {
  final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance();

  manager.fireBeforeRefreshStart(myIsAsync);
  try {
    while (!myWorkQueue.isEmpty() || !myEvents.isEmpty()) {
      PersistentFS.getInstance().processEvents(mergeEventsAndReset());
      scan();
    }
  }
  finally {
    try {
      manager.fireAfterRefreshFinish(myIsAsync);
    }
    finally {
      if (myFinishRunnable != null) {
        myFinishRunnable.run();
      }
    }
  }
}
项目:intellij-ce-playground    文件:LocalFileSystemBase.java   
@Override
public void refreshIoFiles(@NotNull Iterable<File> files, boolean async, boolean recursive, @Nullable Runnable onFinish) {
  final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance();

  Application app = ApplicationManager.getApplication();
  boolean fireCommonRefreshSession = app.isDispatchThread() || app.isWriteAccessAllowed();
  if (fireCommonRefreshSession) manager.fireBeforeRefreshStart(false);

  try {
    List<VirtualFile> filesToRefresh = new ArrayList<VirtualFile>();

    for (File file : files) {
      final VirtualFile virtualFile = refreshAndFindFileByIoFile(file);
      if (virtualFile != null) {
        filesToRefresh.add(virtualFile);
      }
    }

    RefreshQueue.getInstance().refresh(async, recursive, onFinish, filesToRefresh);
  }
  finally {
    if (fireCommonRefreshSession) manager.fireAfterRefreshFinish(false);
  }
}
项目:tools-idea    文件:RefreshSessionImpl.java   
protected void fireEventsInWriteAction() {
  final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance();

  manager.fireBeforeRefreshStart(myIsAsync);
  try {
    while (!myWorkQueue.isEmpty() || !myEvents.isEmpty()) {
      PersistentFS.getInstance().processEvents(mergeEventsAndReset());
      scan();
    }
  }
  finally {
    try {
      manager.fireAfterRefreshFinish(myIsAsync);
    }
    finally {
      if (myFinishRunnable != null) {
        myFinishRunnable.run();
      }
    }
  }
}
项目:tools-idea    文件:LocalFileSystemBase.java   
@Override
public void refreshIoFiles(@NotNull Iterable<File> files, boolean async, boolean recursive, @Nullable Runnable onFinish) {
  final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance();

  Application app = ApplicationManager.getApplication();
  boolean fireCommonRefreshSession = app.isDispatchThread() || app.isWriteAccessAllowed();
  if (fireCommonRefreshSession) manager.fireBeforeRefreshStart(false);

  try {
    List<VirtualFile> filesToRefresh = new ArrayList<VirtualFile>();

    for (File file : files) {
      final VirtualFile virtualFile = refreshAndFindFileByIoFile(file);
      if (virtualFile != null) {
        filesToRefresh.add(virtualFile);
      }
    }

    RefreshQueue.getInstance().refresh(async, recursive, onFinish, filesToRefresh);
  }
  finally {
    if (fireCommonRefreshSession) manager.fireAfterRefreshFinish(false);
  }
}
项目:consulo    文件:LocalFileSystemBase.java   
@Override
public void refreshIoFiles(@Nonnull Iterable<File> files, boolean async, boolean recursive, @Nullable Runnable onFinish) {
  final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance();

  Application app = ApplicationManager.getApplication();
  boolean fireCommonRefreshSession = app.isDispatchThread() || app.isWriteAccessAllowed();
  if (fireCommonRefreshSession) manager.fireBeforeRefreshStart(false);

  try {
    List<VirtualFile> filesToRefresh = new ArrayList<VirtualFile>();

    for (File file : files) {
      final VirtualFile virtualFile = refreshAndFindFileByIoFile(file);
      if (virtualFile != null) {
        filesToRefresh.add(virtualFile);
      }
    }

    RefreshQueue.getInstance().refresh(async, recursive, onFinish, filesToRefresh);
  }
  finally {
    if (fireCommonRefreshSession) manager.fireAfterRefreshFinish(false);
  }
}
项目:intellij-ce-playground    文件:FindInProjectUtil.java   
@Nullable
public static VirtualFile getDirectory(@NotNull final FindModel findModel) {
  String directoryName = findModel.getDirectoryName();
  if (findModel.isProjectScope() || StringUtil.isEmpty(directoryName)) {
    return null;
  }

  String path = directoryName.replace(File.separatorChar, '/');
  VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
  if (virtualFile == null || !virtualFile.isDirectory()) {
    virtualFile = null;
    for (LocalFileProvider provider : ((VirtualFileManagerEx)VirtualFileManager.getInstance()).getLocalFileProviders()) {
      VirtualFile file = provider.findLocalVirtualFileByPath(path);
      if (file != null && file.isDirectory()) {
        if (file.getChildren().length > 0) {
          virtualFile = file;
          break;
        }
        if(virtualFile == null){
          virtualFile = file;
        }
      }
    }
  }
  return virtualFile;

}
项目:tools-idea    文件:FindInProjectUtil.java   
@Nullable
public static PsiDirectory getPsiDirectory(@NotNull final FindModel findModel, @NotNull Project project) {
  String directoryName = findModel.getDirectoryName();
  if (findModel.isProjectScope() || directoryName == null) {
    return null;
  }

  final PsiManager psiManager = PsiManager.getInstance(project);
  String path = directoryName.replace(File.separatorChar, '/');
  VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
  if (virtualFile == null || !virtualFile.isDirectory()) {
    virtualFile = null;
    for (LocalFileProvider provider : ((VirtualFileManagerEx)VirtualFileManager.getInstance()).getLocalFileProviders()) {
      VirtualFile file = provider.findLocalVirtualFileByPath(path);
      if (file != null && file.isDirectory()) {
        if (file.getChildren().length > 0) {
          virtualFile = file;
          break;
        }
        if(virtualFile == null){
           virtualFile = file;
        }
      }
    }
  }
  return virtualFile == null ? null : psiManager.findDirectory(virtualFile);
}
项目:SVNToolBox    文件:ProjectViewManager.java   
@Override
public void disposeComponent() {
    if (myActive.compareAndSet(true, false)) {
        if (myConnection != null) {
            myConnection.disconnect();
        }
        VirtualFileManager vfm = VirtualFileManagerEx.getInstance();
        if (myVfListener != null) {
            vfm.removeVirtualFileListener(myVfListener);
        }
        myStatusCache.dispose();
    }
    super.disposeComponent();
}
项目:consulo    文件:RefreshSessionImpl.java   
private void fireEventsInWriteAction() {
  final VirtualFileManagerEx manager = (VirtualFileManagerEx)VirtualFileManager.getInstance();

  manager.fireBeforeRefreshStart(myIsAsync);
  try {
    while (!myWorkQueue.isEmpty() || !myEvents.isEmpty()) {
      PersistentFS.getInstance().processEvents(mergeEventsAndReset());
      scan();
    }
  }
  catch (AssertionError e) {
    if (FileStatusMap.CHANGES_NOT_ALLOWED_DURING_HIGHLIGHTING.equals(e.getMessage())) {
      throw new AssertionError("VFS changes are not allowed during highlighting", myStartTrace);
    }
    throw e;
  }
  finally {
    try {
      manager.fireAfterRefreshFinish(myIsAsync);
    }
    finally {
      if (myFinishRunnable != null) {
        myFinishRunnable.run();
      }
    }
  }
}
项目:consulo    文件:FindInProjectUtil.java   
@Nullable
public static VirtualFile getDirectory(@Nonnull final FindModel findModel) {
  String directoryName = findModel.getDirectoryName();
  if (findModel.isProjectScope() || StringUtil.isEmpty(directoryName)) {
    return null;
  }

  String path = directoryName.replace(File.separatorChar, '/');
  VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(path);
  if (virtualFile == null || !virtualFile.isDirectory()) {
    virtualFile = null;
    for (LocalFileProvider provider : ((VirtualFileManagerEx)VirtualFileManager.getInstance()).getLocalFileProviders()) {
      VirtualFile file = provider.findLocalVirtualFileByPath(path);
      if (file != null && file.isDirectory()) {
        if (file.getChildren().length > 0) {
          virtualFile = file;
          break;
        }
        if (virtualFile == null) {
          virtualFile = file;
        }
      }
    }
  }
  return virtualFile;

}