本文整理汇总了Java中com.intellij.psi.util.PsiTreeUtil.findChildOfAnyType方法的典型用法代码示例。如果您正苦于以下问题:Java PsiTreeUtil.findChildOfAnyType方法的具体用法?Java PsiTreeUtil.findChildOfAnyType怎么用?Java PsiTreeUtil.findChildOfAnyType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiTreeUtil
的用法示例。
在下文中一共展示了PsiTreeUtil.findChildOfAnyType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIdentifier
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@NotNull
@Override
public AppleScriptIdentifier getIdentifier() {
PsiElement parameter = getParameter();
// AppleScriptSelectorId selectorIdentifier = findNotNullChildByClass(AppleScriptSelectorId.class);
// return selectorIdentifier.getIdentifier();
AppleScriptIdentifier parameterId = PsiTreeUtil.findChildOfAnyType(parameter, AppleScriptIdentifier.class);
return parameterId != null ? parameterId : PsiTreeUtil.getRequiredChildOfType(parameter != null ? parameter :
getLastChild(), AppleScriptIdentifier.class);
}
示例2: createIdentifierFromText
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@Nullable
public static AppleScriptIdentifier createIdentifierFromText(Project project, String name) {
AppleScriptFile file = createFile(project, name);
return PsiTreeUtil.findChildOfAnyType(file, AppleScriptIdentifier.class);
}
示例3: getIndexer
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<String, String, FileContent> getIndexer() {
return inputData -> {
Map<String, String> map = new HashMap<>();
PsiFile psiFile = inputData.getPsiFile();
if (!Settings.isEnabled(psiFile.getProject())) {
return map;
}
if (psiFile instanceof PhpFile) {
MethodReference method = PsiTreeUtil.findChildOfAnyType(psiFile, MethodReference.class);
if (method != null) {
ParameterList parameterList = method.getParameterList();
if (parameterList != null) {
PsiElement firstParameter = parameterList.getFirstPsiChild();
if (firstParameter != null && firstParameter instanceof ClassConstantReference) {
String constantName = ((ClassConstantReference) firstParameter).getName();
if (constantName != null) {
PsiElement moduleNameEl = ((ClassConstantReference) firstParameter).getNextPsiSibling();
if (moduleNameEl != null && moduleNameEl instanceof StringLiteralExpression) {
String moduleName = StringUtil.unquoteString(moduleNameEl.getText());
PsiElement modulePathEl =
((StringLiteralExpression) moduleNameEl).getNextPsiSibling();
if (modulePathEl != null) {
Pattern pattern = Pattern.compile(
"__DIR__(\\s*[.,]\\s*[\\'\\\"]((/[\\w-]+)+)/?[\\'\\\"])?"
);
Matcher matcher = pattern.matcher(modulePathEl.getText());
if (matcher.find()) {
String modulePath = matcher.group(2);
map.put(
moduleName,
modulePath == null ? "" : modulePath
);
}
}
}
}
}
}
}
}
return map;
};
}
示例4: isNilable
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
private static boolean isNilable(SwiftPatternInitializer pattern) {
return PsiTreeUtil.findChildOfAnyType(pattern, SwiftOptionalTypeElement.class, SwiftImplicitlyUnwrappedOptionalTypeElement.class) != null;
}