com.intellij.psi.PsiAnonymousClass Java Examples

The following examples show how to use com.intellij.psi.PsiAnonymousClass. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PsiUtils.java    From intellij-reference-diagram with Apache License 2.0 5 votes vote down vote up
private static PsiElement getRootPsiElementWithStack(PsiClass psiClass, PsiElement psiElement, List<PsiElement> stack) {
    stack.add(psiElement);
    PsiElement parent = psiElement.getParent();
    if (parent == null) {
        return null;
    }
    try {
        if (parent instanceof PsiMethod) {
            if (PsiUtils.classHasMethod(psiClass, (PsiMethod) parent)) {
                return parent;
            }
        } else if (parent instanceof PsiClassInitializer) {
            if (PsiUtils.classHasClassInitializer(psiClass, (PsiClassInitializer) parent)) {
                return parent;
            }
        } else if (parent instanceof PsiField) {
            if (PsiUtils.classHasField(psiClass, (PsiField) parent)) {
                return parent;
            }
        } else if (parent instanceof PsiClass) {
            if (psiClass.equals(((PsiClass) parent).getContainingClass())) {
                return parent;
            }
        } else if (parent instanceof PsiAnonymousClass) {
            if (((PsiAnonymousClass) parent).getContainingClass().equals(psiClass)) {
                return parent;
            }
        }
    } catch (Exception ex) {
        stack.add(parent);
        String preparedStack = prepareStack(stack);
        throw new IllegalStateException("Cannot get root element. Stack: " + preparedStack);
    }

    return getRootPsiElementWithStack(psiClass, parent, stack);
}
 
Example #2
Source File: HaxeMethodsSearch.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
private static boolean cannotBeOverriden(final PsiMethod method) {
  // In Haxe, private really means what protected means in Java.
  // There is no final keyword, either.
  final PsiClass parentClass = method.getContainingClass();
  return parentClass == null
         || method.isConstructor()
         || method.hasModifierProperty(PsiModifier.STATIC)
         || parentClass instanceof PsiAnonymousClass;
}
 
Example #3
Source File: AnonymousClassDeclarationObject.java    From IntelliJDeodorant with MIT License 4 votes vote down vote up
public void setAnonymousClassDeclaration(PsiAnonymousClass anonymous) {
    this.anonymousClassDeclaration = toPointer(anonymous);
}
 
Example #4
Source File: AnonymousClassDeclarationObject.java    From IntelliJDeodorant with MIT License 4 votes vote down vote up
public PsiAnonymousClass getAnonymousClassDeclaration() {
    return (PsiAnonymousClass) anonymousClassDeclaration.getElement();
}