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