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