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


Java FileUtil.deleteWithRenaming方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.deleteWithRenaming方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.deleteWithRenaming方法的具体用法?Java FileUtil.deleteWithRenaming怎么用?Java FileUtil.deleteWithRenaming使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.io.FileUtil的用法示例。


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

示例1: registerIndexer

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
 * @return true if registered index requires full rebuild for some reason, e.g. is just created or corrupted
 */
private <K, V> boolean registerIndexer(@NotNull final FileBasedIndexExtension<K, V> extension) throws IOException {
  final ID<K, V> name = extension.getName();
  final int version = extension.getVersion();
  final File versionFile = IndexInfrastructure.getVersionFile(name);
  final boolean versionFileExisted = versionFile.exists();
  boolean versionChanged = false;
  if (IndexingStamp.versionDiffers(versionFile, version)) {
    if (versionFileExisted) {
      versionChanged = true;
      LOG.info("Version has changed for index " + name + ". The index will be rebuilt.");
    }
    if (extension.hasSnapshotMapping() && versionChanged) {
      FileUtil.deleteWithRenaming(IndexInfrastructure.getPersistentIndexRootDir(name));
    }
    File rootDir = IndexInfrastructure.getIndexRootDir(name);
    if (versionFileExisted) FileUtil.deleteWithRenaming(rootDir);
    IndexingStamp.rewriteVersion(versionFile, version);
  }

  initIndexStorage(extension, version, versionFile);

  return versionChanged;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FileBasedIndexImpl.java

示例2: dropUnregisteredIndices

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void dropUnregisteredIndices() {
  final Set<String> indicesToDrop = readRegisteredIndexNames();
  for (ID<?, ?> key : myIndices.keySet()) {
    indicesToDrop.remove(key.toString());
  }
  for (String s : indicesToDrop) {
    FileUtil.deleteWithRenaming(IndexInfrastructure.getIndexRootDir(ID.create(s)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileBasedIndexImpl.java

示例3: buildStarted

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void buildStarted(CompileContext context) {
  if (myForStubs) {
    File stubRoot = getStubRoot(context);
    if (stubRoot.exists() && !FileUtil.deleteWithRenaming(stubRoot)) {
      context.processMessage(new CompilerMessage(myBuilderName, BuildMessage.Kind.ERROR, "External make cannot clean " + stubRoot.getPath()));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GroovyBuilder.java

示例4: getStubGenerationOutputs

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static Map<ModuleBuildTarget, String> getStubGenerationOutputs(ModuleChunk chunk, CompileContext context) throws IOException {
  Map<ModuleBuildTarget, String> generationOutputs = new HashMap<ModuleBuildTarget, String>();
  File commonRoot = getStubRoot(context);
  for (ModuleBuildTarget target : chunk.getTargets()) {
    File targetRoot = new File(commonRoot, target.getModule().getName() + File.separator + target.getTargetType().getTypeId());
    if (targetRoot.exists() && !FileUtil.deleteWithRenaming(targetRoot)) {
      throw new IOException("External make cannot clean " + targetRoot.getPath());
    }
    if (!targetRoot.mkdirs()) {
      throw new IOException("External make cannot create " + targetRoot.getPath());
    }
    generationOutputs.put(target, targetRoot.getPath());
  }
  return generationOutputs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GroovyBuilder.java

示例5: doInvalidation

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected void doInvalidation(Throwable e) {
  FileUtil.deleteWithRenaming(myFile); // better alternatives ?
  FSRecords.requestVfsRebuild(e);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:VfsDependentEnum.java

示例6: onExceptionInstantiatingIndex

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static void onExceptionInstantiatingIndex(int version, File versionFile, File indexRootDir, Exception e) throws IOException {
  LOG.info(e);
  FileUtil.deleteWithRenaming(indexRootDir);
  IndexingStamp.rewriteVersion(versionFile, version); // todo snapshots indices
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:StubIndexImpl.java

示例7: initIndexStorage

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private <K, V> void initIndexStorage(@NotNull FileBasedIndexExtension<K, V> extension, int version, @NotNull File versionFile)
  throws IOException {
  MapIndexStorage<K, V> storage = null;
  final ID<K, V> name = extension.getName();
  boolean contentHashesEnumeratorOk = false;

  for (int attempt = 0; attempt < 2; attempt++) {
    try {
      if (extension.hasSnapshotMapping()) {
        ContentHashesSupport.initContentHashesEnumerator();
        contentHashesEnumeratorOk = true;
      }
      storage = new MapIndexStorage<K, V>(
        IndexInfrastructure.getStorageFile(name),
        extension.getKeyDescriptor(),
        extension.getValueExternalizer(),
        extension.getCacheSize(),
        extension.keyIsUniqueForIndexedFile(),
        extension.traceKeyHashToVirtualFileMapping()
      );

      final MemoryIndexStorage<K, V> memStorage = new MemoryIndexStorage<K, V>(storage);
      final UpdatableIndex<K, V, FileContent> index = createIndex(name, extension, memStorage);
      final InputFilter inputFilter = extension.getInputFilter();

      myIndices.put(name, new Pair<UpdatableIndex<?, ?, FileContent>, InputFilter>(index, new IndexableFilesFilter(inputFilter)));
      if (inputFilter instanceof FileTypeSpecificInputFilter) {
        ((FileTypeSpecificInputFilter)inputFilter).registerFileTypesUsedForIndexing(new Consumer<FileType>() {
          final Set<FileType> addedTypes = new THashSet<FileType>();
          @Override
          public void consume(FileType type) {
            if (type == null || !addedTypes.add(type)) {
              return;
            }
            List<ID<?, ?>> ids = myFileType2IndicesWithFileTypeInfoMap.get(type);
            if (ids == null) myFileType2IndicesWithFileTypeInfoMap.put(type, ids = new ArrayList<ID<?, ?>>(5));
            ids.add(name);
          }
        });
      }
      else {
        myIndicesWithoutFileTypeInfo.add(name);
      }

      myUnsavedDataUpdateTasks.put(name, new DocumentUpdateTask(name));
      myIndexIdToVersionMap.put(name, version);
      if (!extension.dependsOnFileContent()) {
        if (extension.indexDirectories()) myIndicesForDirectories.add(name);
        myNotRequiringContentIndices.add(name);
      }
      else {
        myRequiringContentIndices.add(name);
      }
      if (extension instanceof PsiDependentIndex) myPsiDependentIndices.add(name);
      myNoLimitCheckTypes.addAll(extension.getFileTypesWithSizeLimitNotApplicable());
      break;
    }
    catch (Exception e) {
      LOG.info(e);
      boolean instantiatedStorage = storage != null;
      try {
        if (storage != null) storage.close();
        storage = null;
      }
      catch (Exception ignored) {
      }

      FileUtil.deleteWithRenaming(IndexInfrastructure.getIndexRootDir(name));

      if (extension.hasSnapshotMapping() && (!contentHashesEnumeratorOk || instantiatedStorage)) {
        FileUtil.deleteWithRenaming(IndexInfrastructure.getPersistentIndexRootDir(name)); // todo there is possibility of corruption of storage and content hashes
      }
      IndexingStamp.rewriteVersion(versionFile, version);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:77,代码来源:FileBasedIndexImpl.java


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