mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove redundant fields from filename & filetype indexes
GitOrigin-RevId: 31045904e4f95960933fbbd0dfca9c20561d86be
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7b20fd3a81
commit
2e4e3f4859
@@ -23,6 +23,7 @@ import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import com.intellij.util.indexing.ID;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -34,11 +35,11 @@ import java.util.Map;
|
||||
*/
|
||||
public class FileTypeIndex {
|
||||
/**
|
||||
* @deprecated Use {@link #getFiles(FileType, GlobalSearchScope)},
|
||||
* Use {@link #getFiles(FileType, GlobalSearchScope)},
|
||||
* {@link #containsFileOfType(FileType, GlobalSearchScope)} or
|
||||
* {@link #processFiles(FileType, Processor, GlobalSearchScope)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.Internal
|
||||
public static final ID<FileType, Void> NAME = ID.create("filetypes");
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.indexing.ID;
|
||||
import com.intellij.util.indexing.IdFilter;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -27,10 +28,9 @@ import java.util.*;
|
||||
*/
|
||||
public class FilenameIndex {
|
||||
|
||||
/**
|
||||
* @deprecated Not to be used.
|
||||
*/
|
||||
@NonNls @Deprecated public static final ID<String, Void> NAME = ID.create("FilenameIndex");
|
||||
@ApiStatus.Internal
|
||||
@NonNls
|
||||
public static final ID<String, Void> NAME = ID.create("FilenameIndex");
|
||||
|
||||
public static String @NotNull [] getAllFilenames(@Nullable Project project) {
|
||||
Set<String> names = new THashSet<>();
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class FileNameIndexServiceImpl implements FileNameIndexService {
|
||||
@Override
|
||||
public Collection<VirtualFile> getVirtualFilesByName(Project project, @NotNull String name, @NotNull GlobalSearchScope scope, IdFilter filter) {
|
||||
Set<VirtualFile> files = new THashSet<>();
|
||||
myIndex.processValues(FilenameIndexImpl.NAME, name, null, (file, value) -> {
|
||||
myIndex.processValues(FilenameIndex.NAME, name, null, (file, value) -> {
|
||||
files.add(file);
|
||||
return true;
|
||||
}, scope, filter);
|
||||
@@ -33,17 +33,17 @@ public final class FileNameIndexServiceImpl implements FileNameIndexService {
|
||||
|
||||
@Override
|
||||
public void processAllFileNames(@NotNull Processor<? super String> processor, @NotNull GlobalSearchScope scope, IdFilter filter) {
|
||||
myIndex.processAllKeys(FilenameIndexImpl.NAME, processor, scope, filter);
|
||||
myIndex.processAllKeys(FilenameIndex.NAME, processor, scope, filter);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<VirtualFile> getFilesWithFileType(@NotNull FileType fileType, @NotNull GlobalSearchScope scope) {
|
||||
return myIndex.getContainingFiles(FileTypeIndexImpl.NAME, fileType, scope);
|
||||
return myIndex.getContainingFiles(FileTypeIndex.NAME, fileType, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processFilesWithFileType(@NotNull FileType fileType, @NotNull Processor<? super VirtualFile> processor, @NotNull GlobalSearchScope scope) {
|
||||
return myIndex.processValues(FileTypeIndexImpl.NAME, fileType, null, (file, value) -> processor.process(file), scope);
|
||||
return myIndex.processValues(FileTypeIndex.NAME, fileType, null, (file, value) -> processor.process(file), scope);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
package com.intellij.psi.search;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.util.indexing.*;
|
||||
import com.intellij.util.indexing.impl.IndexStorage;
|
||||
import com.intellij.util.io.KeyDescriptor;
|
||||
@@ -14,12 +13,10 @@ import java.util.Collections;
|
||||
public final class FileTypeIndexImpl
|
||||
extends ScalarIndexExtension<FileType>
|
||||
implements CustomImplementationFileBasedIndexExtension<FileType, Void> {
|
||||
static final ID<FileType, Void> NAME = FileTypeIndex.NAME;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ID<FileType, Void> getName() {
|
||||
return NAME;
|
||||
return FileTypeIndex.NAME;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -20,18 +20,15 @@ import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry;
|
||||
import com.intellij.util.indexing.*;
|
||||
import com.intellij.util.io.EnumeratorStringDescriptor;
|
||||
import com.intellij.util.io.KeyDescriptor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class FilenameIndexImpl extends ScalarIndexExtension<String> {
|
||||
@NonNls static final ID<String, Void> NAME = FilenameIndex.NAME;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ID<String,Void> getName() {
|
||||
return NAME;
|
||||
return FilenameIndex.NAME;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user