当前位置: 首页>>代码示例>>Java>>正文


Java FilePathHashingStrategy类代码示例

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


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

示例1: processQueue

import com.intellij.util.text.FilePathHashingStrategy; //导入依赖的package包/类
private void processQueue(NewVirtualFileSystem fs, PersistentFS persistence) throws RefreshCancelledException {
  TObjectHashingStrategy<String> strategy = FilePathHashingStrategy.create(fs.isCaseSensitive());

  while (!myRefreshQueue.isEmpty()) {
    Pair<NewVirtualFile, FileAttributes> pair = myRefreshQueue.pullFirst();
    NewVirtualFile file = pair.first;
    boolean fileDirty = file.isDirty();
    debug(LOG, "file=%s dirty=%b", file, fileDirty);
    if (!fileDirty) continue;

    checkCancelled(file);

    FileAttributes attributes = pair.second != null ? pair.second : fs.getAttributes(file);
    if (attributes == null) {
      scheduleDeletion(file);
      continue;
    }

    NewVirtualFile parent = file.getParent();
    if (parent != null && checkAndScheduleFileTypeChange(parent, file, attributes)) {
      // ignore everything else
      file.markClean();
      continue ;
    }

    if (file.isDirectory()) {
      boolean fullSync = ((VirtualDirectoryImpl)file).allChildrenLoaded();
      if (fullSync) {
        fullDirRefresh(fs, persistence, strategy, (VirtualDirectoryImpl)file);
      }
      else {
        partialDirRefresh(fs, strategy, (VirtualDirectoryImpl)file);
      }
    }
    else {
      long currentTimestamp = persistence.getTimeStamp(file);
      long upToDateTimestamp = attributes.lastModified;
      long currentLength = persistence.getLastRecordedLength(file);
      long upToDateLength = attributes.length;

      if (currentTimestamp != upToDateTimestamp || currentLength != upToDateLength) {
        scheduleUpdateContent(file);
      }
    }

    boolean currentWritable = persistence.isWritable(file);
    boolean upToDateWritable = attributes.isWritable();
    if (LOG_ATTRIBUTES.isDebugEnabled()) {
      LOG_ATTRIBUTES.debug("file=" + file + " writable vfs=" + file.isWritable() + " persistence=" + currentWritable + " real=" + upToDateWritable);
    }
    if (currentWritable != upToDateWritable) {
      scheduleAttributeChange(file, VirtualFile.PROP_WRITABLE, currentWritable, upToDateWritable);
    }

    if (SystemInfo.isWindows) {
      boolean currentHidden = file.is(VFileProperty.HIDDEN);
      boolean upToDateHidden = attributes.isHidden();
      if (currentHidden != upToDateHidden) {
        scheduleAttributeChange(file, VirtualFile.PROP_HIDDEN, currentHidden, upToDateHidden);
      }
    }

    if (attributes.isSymLink()) {
      String currentTarget = file.getCanonicalPath();
      String upToDateTarget = fs.resolveSymLink(file);
      String upToDateVfsTarget = upToDateTarget != null ? FileUtil.toSystemIndependentName(upToDateTarget) : null;
      if (!Comparing.equal(currentTarget, upToDateVfsTarget)) {
        scheduleAttributeChange(file, VirtualFile.PROP_SYMLINK_TARGET, currentTarget, upToDateVfsTarget);
      }
    }

    if (myIsRecursive || !file.isDirectory()) {
      file.markClean();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:77,代码来源:RefreshWorker.java

示例2: processQueue

import com.intellij.util.text.FilePathHashingStrategy; //导入依赖的package包/类
private void processQueue(NewVirtualFileSystem fs, PersistentFS persistence) throws RefreshCancelledException {
  TObjectHashingStrategy<String> strategy = FilePathHashingStrategy.create(fs.isCaseSensitive());

  while (!myRefreshQueue.isEmpty()) {
    Pair<NewVirtualFile, FileAttributes> pair = myRefreshQueue.pullFirst();
    NewVirtualFile file = pair.first;
    boolean fileDirty = file.isDirty();
    if (LOG.isTraceEnabled()) LOG.trace("file=" + file + " dirty=" + fileDirty);
    if (!fileDirty) continue;

    checkCancelled(file);

    FileAttributes attributes = pair.second != null ? pair.second : fs.getAttributes(file);
    if (attributes == null) {
      scheduleDeletion(file);
      continue;
    }

    NewVirtualFile parent = file.getParent();
    if (parent != null && checkAndScheduleFileTypeChange(parent, file, attributes)) {
      // ignore everything else
      file.markClean();
      continue ;
    }

    if (file.isDirectory()) {
      boolean fullSync = ((VirtualDirectoryImpl)file).allChildrenLoaded();
      if (fullSync) {
        fullDirRefresh(fs, persistence, strategy, (VirtualDirectoryImpl)file);
      }
      else {
        partialDirRefresh(fs, strategy, (VirtualDirectoryImpl)file);
      }
    }
    else {
      long currentTimestamp = persistence.getTimeStamp(file);
      long upToDateTimestamp = attributes.lastModified;
      long currentLength = persistence.getLastRecordedLength(file);
      long upToDateLength = attributes.length;

      if (currentTimestamp != upToDateTimestamp || currentLength != upToDateLength) {
        scheduleUpdateContent(file);
      }
    }

    boolean currentWritable = persistence.isWritable(file);
    boolean upToDateWritable = attributes.isWritable();
    if (LOG_ATTRIBUTES.isDebugEnabled()) {
      LOG_ATTRIBUTES.debug("file=" + file + " writable vfs=" + file.isWritable() + " persistence=" + currentWritable + " real=" + upToDateWritable);
    }
    if (currentWritable != upToDateWritable) {
      scheduleAttributeChange(file, VirtualFile.PROP_WRITABLE, currentWritable, upToDateWritable);
    }

    if (SystemInfo.isWindows) {
      boolean currentHidden = file.is(VFileProperty.HIDDEN);
      boolean upToDateHidden = attributes.isHidden();
      if (currentHidden != upToDateHidden) {
        scheduleAttributeChange(file, VirtualFile.PROP_HIDDEN, currentHidden, upToDateHidden);
      }
    }

    if (attributes.isSymLink()) {
      String currentTarget = file.getCanonicalPath();
      String upToDateTarget = fs.resolveSymLink(file);
      String upToDateVfsTarget = upToDateTarget != null ? FileUtil.toSystemIndependentName(upToDateTarget) : null;
      if (!Comparing.equal(currentTarget, upToDateVfsTarget)) {
        scheduleAttributeChange(file, VirtualFile.PROP_SYMLINK_TARGET, currentTarget, upToDateVfsTarget);
      }
    }

    if (myIsRecursive || !file.isDirectory()) {
      file.markClean();
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:77,代码来源:RefreshWorker.java


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