本文整理汇总了Java中com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer类的典型用法代码示例。如果您正苦于以下问题:Java LexerBasedIdIndexer类的具体用法?Java LexerBasedIdIndexer怎么用?Java LexerBasedIdIndexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LexerBasedIdIndexer类属于com.intellij.psi.impl.cache.impl.id包,在下文中一共展示了LexerBasedIdIndexer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanContent
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer; //导入依赖的package包/类
public static ScanContent scanContent(FileContent content, IdAndToDoScannerBasedOnFilterLexer indexer) {
ScanContent data = content.getUserData(scanContentKey);
if (data != null) {
content.putUserData(scanContentKey, null);
return data;
}
final boolean needTodo = content.getFile().isInLocalFileSystem(); // same as TodoIndex.getFilter().isAcceptable
final boolean needIdIndex = IdTableBuilding.getFileTypeIndexer(content.getFileType()) instanceof LexerBasedIdIndexer;
final IdDataConsumer consumer = needIdIndex? new IdDataConsumer():null;
final OccurrenceConsumer todoOccurrenceConsumer = new OccurrenceConsumer(consumer, needTodo);
final Lexer filterLexer = indexer.createLexer(todoOccurrenceConsumer);
filterLexer.start(content.getContentAsText());
while (filterLexer.getTokenType() != null) filterLexer.advance();
Map<TodoIndexEntry,Integer> todoMap = null;
if (needTodo) {
for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
final int count = todoOccurrenceConsumer.getOccurrenceCount(indexPattern);
if (count > 0) {
if (todoMap == null) todoMap = new THashMap<TodoIndexEntry, Integer>();
todoMap.put(new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), count);
}
}
}
data = new ScanContent(
consumer != null? consumer.getResult():Collections.<IdIndexEntry, Integer>emptyMap(),
todoMap != null ? todoMap: Collections.<TodoIndexEntry,Integer>emptyMap()
);
if (needIdIndex && needTodo) content.putUserData(scanContentKey, data);
return data;
}
示例2: scanContent
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer; //导入依赖的package包/类
public static ScanContent scanContent(FileContent content, IdAndToDoScannerBasedOnFilterLexer indexer) {
ScanContent data = content.getUserData(scanContentKey);
if (data != null) {
content.putUserData(scanContentKey, null);
return data;
}
final boolean needTodo = content.getFile().getFileSystem().getProtocol().equals(StandardFileSystems.FILE_PROTOCOL);
final boolean needIdIndex = IdTableBuilding.getFileTypeIndexer(content.getFileType()) instanceof LexerBasedIdIndexer;
final IdDataConsumer consumer = needIdIndex? new IdDataConsumer():null;
final OccurrenceConsumer todoOccurrenceConsumer = new OccurrenceConsumer(consumer, needTodo);
final Lexer filterLexer = indexer.createLexer(todoOccurrenceConsumer);
filterLexer.start(content.getContentAsText());
while (filterLexer.getTokenType() != null) filterLexer.advance();
Map<TodoIndexEntry,Integer> todoMap = null;
if (needTodo) {
for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
final int count = todoOccurrenceConsumer.getOccurrenceCount(indexPattern);
if (count > 0) {
if (todoMap == null) todoMap = new THashMap<TodoIndexEntry, Integer>();
todoMap.put(new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), count);
}
}
}
data = new ScanContent(
consumer != null? consumer.getResult():Collections.<IdIndexEntry, Integer>emptyMap(),
todoMap != null ? todoMap: Collections.<TodoIndexEntry,Integer>emptyMap()
);
if (needIdIndex && needTodo) content.putUserData(scanContentKey, data);
return data;
}
示例3: scanContent
import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer; //导入依赖的package包/类
public static ScanContent scanContent(FileContent content, IdAndToDoScannerBasedOnFilterLexer indexer) {
ScanContent data = content.getUserData(scanContentKey);
if (data != null) {
content.putUserData(scanContentKey, null);
return data;
}
final boolean needTodo = content.getFile().getFileSystem() instanceof LocalFileSystem;
final boolean needIdIndex = IdTableBuilding.getFileTypeIndexer(content.getFileType()) instanceof LexerBasedIdIndexer;
final IdDataConsumer consumer = needIdIndex? new IdDataConsumer():null;
final OccurrenceConsumer todoOccurrenceConsumer = new OccurrenceConsumer(consumer, needTodo);
final Lexer filterLexer = indexer.createLexer(todoOccurrenceConsumer);
filterLexer.start(content.getContentAsText());
while (filterLexer.getTokenType() != null) filterLexer.advance();
Map<TodoIndexEntry,Integer> todoMap = null;
if (needTodo) {
for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
final int count = todoOccurrenceConsumer.getOccurrenceCount(indexPattern);
if (count > 0) {
if (todoMap == null) todoMap = new THashMap<TodoIndexEntry, Integer>();
todoMap.put(new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), count);
}
}
}
data = new ScanContent(
consumer != null? consumer.getResult():Collections.<IdIndexEntry, Integer>emptyMap(),
todoMap != null ? todoMap: Collections.<TodoIndexEntry,Integer>emptyMap()
);
if (needIdIndex && needTodo) content.putUserData(scanContentKey, data);
return data;
}