本文整理汇总了Java中com.intellij.psi.util.PsiTreeUtil.processElements方法的典型用法代码示例。如果您正苦于以下问题:Java PsiTreeUtil.processElements方法的具体用法?Java PsiTreeUtil.processElements怎么用?Java PsiTreeUtil.processElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiTreeUtil
的用法示例。
在下文中一共展示了PsiTreeUtil.processElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFoldRegions
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@NotNull
@Override
public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
List<FoldingDescriptor> descriptors = new ArrayList<>();
PsiTreeUtil.processElements(root, element -> {
IElementType elementType = element.getNode().getElementType();
MlTypes types = elementType.getLanguage() == RmlLanguage.INSTANCE ? RmlTypes.INSTANCE : OclTypes.INSTANCE;
if (types.COMMENT == elementType) {
FoldingDescriptor fold = fold(element);
if (fold != null) {
descriptors.add(fold);
}
} else if (types.TYPE_EXPRESSION == elementType) {
foldType(descriptors, (PsiType) element);
} else if (types.LET_EXPRESSION == elementType) {
foldLet(descriptors, (PsiLet) element);
} else if (types.MODULE_EXPRESSION == elementType) {
foldModule(descriptors, (PsiModule) element);
}
return true;
});
return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
}
示例2: findFoldingBlocksAndLineBreaks
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@NotNull
@Contract(pure = true)
protected Collection<PsiElement> findFoldingBlocksAndLineBreaks(@Nullable final PsiElement root) {
if (root == null) {
return Collections.emptyList();
}
final List<PsiElement> foldingBlocks = newArrayList();
PsiTreeUtil.processElements(root, new CollectFilteredElements<>(
PsiElementFilterFactory.getPsiElementFilter(), foldingBlocks
));
return foldingBlocks;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:15,代码来源:ImpexFoldingBuilder.java
示例3: foldingLines
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@NotNull
@Contract(pure = true)
protected List<PsiElement> foldingLines(@Nullable final PsiElement root) {
if (root == null) {
return Collections.emptyList();
}
final List<PsiElement> foldingBlocks = newArrayList();
PsiTreeUtil.processElements(root, new CollectFilteredElements<>(
new ImpexFoldingLinesFilter(), foldingBlocks));
return foldingBlocks;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:14,代码来源:ImpexFoldingLinesBuilder.java