本文整理汇总了Java中com.intellij.psi.PsiElement.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java PsiElement.getChildren方法的具体用法?Java PsiElement.getChildren怎么用?Java PsiElement.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiElement
的用法示例。
在下文中一共展示了PsiElement.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: seekChildren
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void seekChildren(PsiElement element, PsiIdentifier target, Find find) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiLocalVariable) {
PsiLocalVariable localVariable = (PsiLocalVariable) child;
if (isSameName(target, localVariable.getNameIdentifier())) {
find.findLocalVariable = localVariable;
return;
}
}
if (child instanceof PsiParameter) {
PsiParameter parameter = (PsiParameter) child;
if (isSameName(target, parameter.getNameIdentifier())) {
find.findParameter = parameter;
return;
}
}
seekChildren(child, target, find);
if (!find.isEmpty()) return;
}
}
示例2: recursiveFill
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private void recursiveFill(List<String> results, PsiElement psiElement) {
if (PhpPatternsHelper.STRING_METHOD_ARGUMENT.accepts(psiElement) && isInContextOfDispatchMethod(psiElement)) {
String eventName= StringUtil.unquoteString(psiElement.getText());
if (eventName.length() > 0) {
results.add(eventName);
}
return;
}
for(PsiElement child: psiElement.getChildren()) {
recursiveFill(results, child);
}
}
示例3: getYoungerBrother
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
/**
* 弟要素(ノード)取得
* @param element ルートノード
* @return 兄弟要素の弟分(右側)のリスト (空要素の場合もあります)
*/
public static @Nullable List<PsiElement> getYoungerBrother(@NonNull PsiElement element) {
List<PsiElement> youngerBrothers = new ArrayList<>();
PsiElement parent = LintUtils.skipParentheses(element.getParent());
if (parent == null) return youngerBrothers;
boolean isYounger = false;
for (PsiElement brother : parent.getChildren()) {
if (isYounger) youngerBrothers.add(brother);
if (brother == element) isYounger = true;
}
return youngerBrothers;
}
示例4: parseChildren
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
public String parseChildren(PsiElement element) {
PsiElement[] children = element.getChildren();
String childrenInfo = "";
childrenInfo = ">>>[";
for (PsiElement child : children) {
childrenInfo += (child.getText() + ":" + child.getClass().getSimpleName() + ", ");
}
childrenInfo += (childrenInfo.isEmpty() ? "]<<<" : "\n]<<<");
return childrenInfo;
}
示例5: getMyBrotherIndex
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static int getMyBrotherIndex(PsiElement my) {
PsiElement parent =LintUtils.skipParentheses( my.getParent());
if (parent == null) return ERROR_INDEX;
PsiElement[] brothers = parent.getChildren();
for (int index = 0; index < brothers.length; index++) {
if (brothers[index] == my) return index;
}
return ERROR_INDEX;
}
示例6: writeValueLine
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void writeValueLine(
final int[] maxColumnWidth,
final StringBuilder sb,
final PsiElement currentValueLine
) {
if (isImpexValueGroup(currentValueLine.getFirstChild())) {
sb.append(StringUtils.rightPad("", maxColumnWidth[0] + 1));
} else {
final String text = StringUtils.rightPad(
currentValueLine.getFirstChild().getText().trim(),
maxColumnWidth[0]
);
sb.append(text);
}
final PsiElement[] children = currentValueLine.getChildren();
int i = 1;
for (final PsiElement element : children) {
final int length = maxColumnWidth.length - 1;
if (isFirstFieldValueIsEmpty(element)) {
sb.append(';').append(' ').append(StringUtils.rightPad("", maxColumnWidth[min(i, length
)]));
} else {
sb
.append(';')
.append(' ')
.append(StringUtils.rightPad(
element.getLastChild().getText().trim(),
maxColumnWidth[min(i, length)]
));
}
i++;
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:35,代码来源:ImpexTableFormatter.java
示例7: getColumnForHeader
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
public static List<PsiElement> getColumnForHeader(@NotNull final ImpexFullHeaderParameter headerParameter) {
final PsiElement[] children = headerParameter.getParent().getChildren();
int i = -2;
for (final PsiElement child : children) {
if (!child.equals(headerParameter)) {
i++;
} else {
break;
}
}
final List<PsiElement> result = newArrayList();
PsiElement psiElement = getNextSiblingOfAnyType(
PsiTreeUtil.getParentOfType(headerParameter, ImpexHeaderLine.class),
ImpexValueLine.class,
ImpexHeaderLine.class,
ImpexRootMacroUsage.class
);
while (psiElement != null && !isHeaderLine(psiElement) && !isUserRightsMacros(psiElement)) {
if (isImpexValueLine(psiElement)) {
final PsiElement[] elements = psiElement.getChildren();
if (elements.length > i) {
result.add(elements[i]);
}
}
psiElement = getNextSiblingOfAnyType(
psiElement,
ImpexValueLine.class,
ImpexHeaderLine.class,
ImpexRootMacroUsage.class
);
}
return result;
}
示例8: childCount
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private Integer childCount(PsiElement psiElement)
{
// firstChild and getChildren()[0] is apparently not the same thing...
PsiElement[] children = psiElement.getChildren();
if (children.length == 0)
{
return 0;
}
return children[0]
.getChildren()
.length;
}
示例9: extractFields
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void extractFields(@NonNull PsiElement element, List<PsiField> fields) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiField) {
fields.add((PsiField) child);
continue;
}
extractFields(child, fields);
}
}
示例10: extractMethods
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void extractMethods(@NonNull PsiElement element, List<PsiMethod> methods) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiMethod) {
methods.add((PsiMethod) child);
continue;
}
extractMethods(child, methods);
}
}
示例11: extractStatements
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void extractStatements(@NonNull PsiElement element, List<PsiStatement> statements) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiStatement) {
statements.add((PsiStatement) child);
continue;
}
extractStatements(child, statements);
}
}
示例12: extractDeclarations
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void extractDeclarations(@NonNull PsiElement element, List<PsiDeclarationStatement> declarations) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiDeclarationStatement) {
declarations.add((PsiDeclarationStatement) child);
continue;
}
extractDeclarations(child, declarations);
}
}
示例13: getElderBrother
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
/**
* 兄要素(ノード)取得
* @param element ルートノード
* @return 兄弟要素の兄分(左側)のリスト (空要素の場合もあります)
*/
public static @Nullable List<PsiElement> getElderBrother(@NonNull PsiElement element) {
List<PsiElement> elderBrothers = new ArrayList<>();
PsiElement parent = LintUtils.skipParentheses(element.getParent());
if (parent == null) return elderBrothers;
for (PsiElement brother : parent.getChildren()) {
if (brother == element) break;
elderBrothers.add(brother);
}
return elderBrothers;
}
示例14: extractVariables
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void extractVariables(@NonNull PsiElement element, List<PsiVariable> variables) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiVariable) {
variables.add((PsiVariable) child);
continue;
}
extractVariables(child, variables);
}
}
示例15: extractReference
import com.intellij.psi.PsiElement; //导入方法依赖的package包/类
private static void extractReference(@NonNull PsiElement element, List<PsiReferenceExpression> references) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiReferenceExpression) {
references.add((PsiReferenceExpression) child);
continue;
}
extractReference(child, references);
}
}