本文整理汇总了Java中com.intellij.util.indexing.DataIndexer类的典型用法代码示例。如果您正苦于以下问题:Java DataIndexer类的具体用法?Java DataIndexer怎么用?Java DataIndexer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataIndexer类属于com.intellij.util.indexing包,在下文中一共展示了DataIndexer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public Map<TodoIndexEntry, Integer> map(@NotNull FileContent inputData) {
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
if (result.containsKey(key)) {
result.put(key, result.get(key) + entry.getValue());
} else {
result.put(key, entry.getValue());
}
}
}
return result;
}
示例2: map
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public Map<TodoIndexEntry, Integer> map(FileContent inputData) {
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
if (result.containsKey(key)) {
result.put(key, result.get(key) + entry.getValue());
} else {
result.put(key, entry.getValue());
}
}
}
return result;
}
示例3: map
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@Nonnull
@Override
public Map<TodoIndexEntry, Integer> map(FileContent inputData) {
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
if (result.containsKey(key)) {
result.put(key, result.get(key) + entry.getValue());
}
else {
result.put(key, entry.getValue());
}
}
}
return result;
}
示例4: getTodoIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@Nullable
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
final DataIndexer<TodoIndexEntry, Integer, FileContent> indexer = ourTodoIndexers.get(fileType);
if (indexer != null) {
return indexer;
}
final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer;
if (fileType instanceof SubstitutedFileType && !((SubstitutedFileType)fileType).isSameFileType()) {
SubstitutedFileType sft = (SubstitutedFileType)fileType;
extIndexer =
new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), virtualFile), getTodoIndexer(sft.getFileType(), virtualFile));
}
else {
extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
}
if (extIndexer != null) {
return extIndexer;
}
if (fileType instanceof LanguageFileType) {
final Language lang = ((LanguageFileType)fileType).getLanguage();
final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
if (commentTokens != null) {
return new TokenSetTodoIndexer(commentTokens, virtualFile);
}
}
if (fileType instanceof CustomSyntaxTableFileType) {
return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
}
return null;
}
示例5: getVersion
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@Override
public int getVersion() {
int version = super.getVersion();
for(DataIndexer dataIndexer:indexers) {
version += dataIndexer instanceof VersionedTodoIndexer ? ((VersionedTodoIndexer)dataIndexer).getVersion() : 0xFF;
}
return version;
}
示例6: getIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@Override
protected DataIndexer<MethodNameAndQualifier, List<CallingLocation>, ClassReader> getIndexer() {
return new DataIndexer<MethodNameAndQualifier, List<CallingLocation>, ClassReader>() {
@NotNull
@Override
public Map<MethodNameAndQualifier, List<CallingLocation>> map(final ClassReader inputData) {
return MethodCallingLocationExtractor.extract(inputData);
}
};
}
示例7: getTodoIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@Nullable
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
final DataIndexer<TodoIndexEntry, Integer, FileContent> indexer = ourTodoIndexers.get(fileType);
if (indexer != null) {
return indexer;
}
final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer;
if (fileType instanceof SubstitutedFileType) {
SubstitutedFileType sft = (SubstitutedFileType)fileType;
extIndexer =
new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), virtualFile), getTodoIndexer(sft.getFileType(), virtualFile));
}
else {
extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
}
if (extIndexer != null) {
return extIndexer;
}
if (fileType instanceof LanguageFileType) {
final Language lang = ((LanguageFileType)fileType).getLanguage();
final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
if (commentTokens != null) {
return new TokenSetTodoIndexer(commentTokens, virtualFile);
}
}
if (fileType instanceof CustomSyntaxTableFileType) {
return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
}
return null;
}
示例8: getTodoIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@javax.annotation.Nullable
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, Project project, final VirtualFile virtualFile) {
final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer;
if (fileType instanceof SubstitutedFileType && !((SubstitutedFileType)fileType).isSameFileType()) {
SubstitutedFileType sft = (SubstitutedFileType)fileType;
extIndexer = new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), project, virtualFile), getTodoIndexer(sft.getFileType(), project, virtualFile));
}
else {
extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
}
if (extIndexer != null) {
return extIndexer;
}
if (fileType instanceof LanguageFileType) {
final Language lang = ((LanguageFileType)fileType).getLanguage();
final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
LanguageVersion languageVersion = LanguageVersionUtil.findLanguageVersion(lang, project, virtualFile);
final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens(languageVersion) : null;
if (commentTokens != null) {
return new TokenSetTodoIndexer(commentTokens, languageVersion, virtualFile, project);
}
}
if (fileType instanceof CustomSyntaxTableFileType) {
return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, null, virtualFile, project);
}
return null;
}
示例9: getVersion
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@Override
public int getVersion() {
int version = VersionedTodoIndexer.super.getVersion();
for (DataIndexer dataIndexer : indexers) {
version += dataIndexer instanceof VersionedTodoIndexer ? ((VersionedTodoIndexer)dataIndexer).getVersion() : 0xFF;
}
return version;
}
示例10: DomFileIndex
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
public DomFileIndex()
{
myDataIndexer = new DataIndexer<String, Void, FileContent>()
{
@Override
@NotNull
public Map<String, Void> map(final FileContent inputData)
{
final Set<String> namespaces = new THashSet<String>();
final XmlFileHeader header = NanoXmlUtil.parseHeader(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
ContainerUtil.addIfNotNull(namespaces, header.getPublicId());
ContainerUtil.addIfNotNull(namespaces, header.getSystemId());
ContainerUtil.addIfNotNull(namespaces, header.getRootTagNamespace());
final String tagName = header.getRootTagLocalName();
if(StringUtil.isNotEmpty(tagName))
{
final THashMap<String, Void> result = new THashMap<String, Void>();
final DomApplicationComponent component = DomApplicationComponent.getInstance();
for(final DomFileDescription description : component.getFileDescriptions(tagName))
{
final String[] strings = description.getAllPossibleRootTagNamespaces();
if(strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces))
{
result.put(description.getRootElementClass().getName(), null);
}
}
for(final DomFileDescription description : component.getAcceptingOtherRootTagNameDescriptions())
{
final String[] strings = description.getAllPossibleRootTagNamespaces();
if(strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces))
{
result.put(description.getRootElementClass().getName(), null);
}
}
return result;
}
return Collections.emptyMap();
}
};
}
示例11: getIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Integer, FileContent> getIndexer() {
return inputData -> {
Set<PsiElement> elements = new HashSet<>();
Collections.addAll(
elements,
PsiTreeUtil.collectElements(inputData.getPsiFile(), el -> PlatformPatterns
.psiElement(StringLiteralExpression.class)
.withParent(
PlatformPatterns.psiElement(PhpElementTypes.ARRAY_KEY)
.withAncestor(
4,
PlatformPatterns.psiElement(PhpElementTypes.RETURN)
)
)
.accepts(el)
)
);
Map<String, Integer> methodMap = new HashMap<>();
for (PsiElement gatheredElement : elements) {
PsiElement parent = gatheredElement.getParent().getParent();
if (parent instanceof ArrayHashElement) {
ArrayHashElement arr = (ArrayHashElement) parent;
PhpPsiElement value = arr.getValue();
if (value != null && value instanceof ArrayCreationExpression) {
ArrayCreationExpression creationExpression = (ArrayCreationExpression) value;
creationExpression.getHashElements().forEach(x -> {
PhpPsiElement key = x.getKey();
if (key != null && key.getText().contains("maximumNumberOfArguments")) {
methodMap.put("\\" + ((StringLiteralExpression) gatheredElement).getContents(), Integer.parseInt(x.getValue().getText()));
}
});
}
}
}
return methodMap;
};
}
示例12: getIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return new LayoutDataIndexer("container", "name");
}
示例13: getIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return new LayoutDataIndexer("block", "name");
}
示例14: getIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return new LayoutDataIndexer("block", "class", PhpLangUtil::toPresentableFQN);
}
示例15: getIndexer
import com.intellij.util.indexing.DataIndexer; //导入依赖的package包/类
@NotNull
@Override
public DataIndexer<String, Void, FileContent> getIndexer() {
return new NodeTypesYamlIndexer();
}