本文整理匯總了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