本文整理汇总了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;
}
示例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)));
}
}
示例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()));
}
}
}
示例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;
}
示例5: doInvalidation
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected void doInvalidation(Throwable e) {
FileUtil.deleteWithRenaming(myFile); // better alternatives ?
FSRecords.requestVfsRebuild(e);
}
示例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
}
示例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);
}
}
}