mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
duplicateindex should process java files only in source roots
This commit is contained in:
@@ -17,6 +17,7 @@ package com.intellij.dupLocator;
|
||||
|
||||
import com.intellij.lang.LighterAST;
|
||||
import com.intellij.lang.LighterASTNode;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface LightDuplicateProfile {
|
||||
void process(@NotNull LighterAST ast, @NotNull Callback callback);
|
||||
boolean acceptsFile(@NotNull VirtualFile file);
|
||||
|
||||
interface Callback {
|
||||
void process(int hash, int hash2, @NotNull LighterAST ast, @NotNull LighterASTNode... nodes);
|
||||
|
||||
+11
-5
@@ -61,10 +61,16 @@ public class DuplicatesIndex extends FileBasedIndexExtension<Integer, TIntArrayL
|
||||
private final FileBasedIndex.InputFilter myInputFilter = new FileBasedIndex.InputFilter() {
|
||||
@Override
|
||||
public boolean acceptInput(@NotNull final VirtualFile file) {
|
||||
return ourEnabled &&
|
||||
findDuplicatesProfile(file.getFileType()) != null &&
|
||||
file.isInLocalFileSystem() // skip library sources
|
||||
;
|
||||
if (!ourEnabled ||
|
||||
!file.isInLocalFileSystem() // skip library sources
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
DuplicatesProfile duplicatesProfile = findDuplicatesProfile(file.getFileType());
|
||||
if (duplicatesProfile instanceof LightDuplicateProfile) {
|
||||
return ((LightDuplicateProfile)duplicatesProfile).acceptsFile(file);
|
||||
}
|
||||
return duplicatesProfile != null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -163,7 +169,7 @@ public class DuplicatesIndex extends FileBasedIndexExtension<Integer, TIntArrayL
|
||||
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return myBaseVersion + (ourEnabled ? 0xFF : 0) + (ourEnabledLightProfiles ? 0x7F : 0) + (ourEnabledOldProfiles ? 0x21 : 0);
|
||||
return myBaseVersion + (ourEnabled ? 0xFF : 0) + (ourEnabledLightProfiles ? 0x80 : 0) + (ourEnabledOldProfiles ? 0x21 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user