Skip to content

Commit

Permalink
introduced FileTypeSpecificInputFilter for index to expose its applic…
Browse files Browse the repository at this point in the history
…ability to specific file types: allows us to have faster calculation of affected indices candidates
  • Loading branch information
Maxim.Mossienko authored and Maxim.Mossienko committed Jun 6, 2013
1 parent 3a5eca9 commit 3c96235
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 4 additions & 8 deletions Dart/src/com/jetbrains/lang/dart/ide/index/DartInputFilter.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package com.jetbrains.lang.dart.ide.index;

import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.indexing.FileBasedIndex;
import com.intellij.util.indexing.DefaultFileTypeSpecificInputFilter;
import com.jetbrains.lang.dart.DartFileType;

public class DartInputFilter implements FileBasedIndex.InputFilter {
public class DartInputFilter extends DefaultFileTypeSpecificInputFilter {
public static DartInputFilter INSTANCE = new DartInputFilter();

@Override
public boolean acceptInput(VirtualFile file) {
FileType type = file.getFileType();
return type == DartFileType.INSTANCE || type == StdFileTypes.HTML;
public DartInputFilter() {
super(DartFileType.INSTANCE, StdFileTypes.HTML);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ public class JstdTestFilePathIndex extends FileBasedIndexExtension<String, Void>

private static final ID<String, Void> KEY = ID.create("jstd.jsFile.path");

private static final FileBasedIndex.InputFilter JSTD_CONFIG_FILE_INPUT_FILTER = new FileBasedIndex.InputFilter() {
@Override
public boolean acceptInput(final VirtualFile file) {
return JstdConfigFileType.INSTANCE == file.getFileType();
}
};

private final KeyDescriptor<String> myKeyDescriptor = new EnumeratorStringDescriptor();

@NotNull
Expand Down Expand Up @@ -90,7 +83,7 @@ public DataExternalizer<Void> getValueExternalizer() {

@Override
public FileBasedIndex.InputFilter getInputFilter() {
return JSTD_CONFIG_FILE_INPUT_FILTER;
return new DefaultFileTypeSpecificInputFilter(JstdConfigFileType.INSTANCE);
}

@Override
Expand Down

0 comments on commit 3c96235

Please sign in to comment.