本文整理汇总了Java中com.intellij.psi.util.PsiUtil.isLocalOrAnonymousClass方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.isLocalOrAnonymousClass方法的具体用法?Java PsiUtil.isLocalOrAnonymousClass怎么用?Java PsiUtil.isLocalOrAnonymousClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiUtil
的用法示例。
在下文中一共展示了PsiUtil.isLocalOrAnonymousClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNonAnonymousClassName
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
public static String getNonAnonymousClassName(PsiClass aClass) {
if (PsiUtil.isLocalOrAnonymousClass(aClass)) {
return null;
}
String name = aClass.getName();
if (name == null) {
return null;
}
PsiClass parentClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true);
if (parentClass != null) {
final String parentName = getNonAnonymousClassName(parentClass);
if (parentName == null) {
return null;
}
return parentName + "$" + name;
}
return DebuggerManager.getInstance(aClass.getProject()).getVMClassQualifiedName(aClass);
}
示例2: createInitialStates
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
private Collection<DfaMemoryState> createInitialStates(@NotNull PsiElement psiBlock, InstructionVisitor visitor) {
PsiClass containingClass = PsiTreeUtil.getParentOfType(psiBlock, PsiClass.class);
if (containingClass != null && PsiUtil.isLocalOrAnonymousClass(containingClass)) {
final PsiElement parent = containingClass.getParent();
final PsiCodeBlock block = DfaPsiUtil.getTopmostBlockInSameClass(parent);
if ((parent instanceof PsiNewExpression || parent instanceof PsiDeclarationStatement) && block != null) {
final RunnerResult result = analyzeMethod(block, visitor);
if (result == RunnerResult.OK) {
final Collection<DfaMemoryState> closureStates = myNestedClosures.get(DfaPsiUtil.getTopmostBlockInSameClass(psiBlock));
if (!closureStates.isEmpty()) {
return closureStates;
}
}
return null;
}
}
return Collections.singletonList(createMemoryState());
}
示例3: analyzeCodeBlock
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private void analyzeCodeBlock(@Nullable final PsiElement scope, ProblemsHolder holder, final boolean onTheFly) {
if (scope == null) return;
PsiClass containingClass = PsiTreeUtil.getParentOfType(scope, PsiClass.class);
if (containingClass != null && PsiUtil.isLocalOrAnonymousClass(containingClass) && !(containingClass instanceof PsiEnumConstantInitializer)) return;
final StandardDataFlowRunner dfaRunner = new StandardDataFlowRunner(TREAT_UNKNOWN_MEMBERS_AS_NULLABLE, !isInsideConstructorOrInitializer(
scope)) {
@Override
protected boolean shouldCheckTimeLimit() {
if (!onTheFly) return false;
return super.shouldCheckTimeLimit();
}
};
analyzeDfaWithNestedClosures(scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()), onTheFly);
}
示例4: getSuperClass
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
@Override
public ResolvedClass getSuperClass() {
if (myClass != null) {
PsiClass superClass = myClass.getSuperClass();
// When you make an anonymous inner class from an interface like this,
// we want to treat the interface itself as the "super class"
// public View.OnClickListener onSave = new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// ..
if (PsiUtil.isLocalOrAnonymousClass(myClass)) {
PsiClass[] interfaces = myClass.getInterfaces();
if (interfaces.length > 0) {
return new ResolvedPsiClass(interfaces[0]);
}
}
if (superClass != null) {
return new ResolvedPsiClass(superClass);
}
}
return null;
}