private static boolean canImplementOverride(final MethodHierarchyNodeDescriptor descriptor, final MethodHierarchyBrowser methodHierarchyBrowser, final boolean toImplement) { final PsiElement psiElement = descriptor.getPsiClass(); if(!(psiElement instanceof PsiClass)) { return false; } final PsiClass psiClass = (PsiClass) psiElement; if(psiClass instanceof PsiSyntheticClass) { return false; } final PsiMethod baseMethod = methodHierarchyBrowser.getBaseMethod(); if(baseMethod == null) { return false; } final MethodSignature signature = baseMethod.getSignature(PsiSubstitutor.EMPTY); Collection<MethodSignature> allOriginalSignatures = toImplement ? OverrideImplementUtil.getMethodSignaturesToImplement(psiClass) : OverrideImplementUtil.getMethodSignaturesToOverride (psiClass); for(final MethodSignature originalSignature : allOriginalSignatures) { if(originalSignature.equals(signature)) { return true; } } return false; }
private void buildChildren(final List<Block> result, final Alignment childAlignment, final Wrap childWrap) { ASTNode child = myNode.getFirstChildNode(); int state = BEFORE_FIRST; if(myNode.getPsi() instanceof PsiSyntheticClass) { state = INSIDE_BODY; } ChildAlignmentStrategyProvider provider = getStrategyProvider(); while(child != null) { if(!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0) { AlignmentStrategy alignmentStrategy = provider.getNextChildStrategy(child); final Indent indent = calcCurrentIndent(child, state); state = calcNewState(child, state); if(child.getElementType() == JavaElementType.SWITCH_LABEL_STATEMENT) { child = processCaseAndStatementAfter(result, child, childAlignment, childWrap, indent); } else if((myNode.getPsi() instanceof PsiClass || myNode.getPsi() instanceof PsiJavaModule) && child.getElementType() == JavaTokenType.LBRACE) { child = composeCodeBlock(result, child, getCodeBlockExternalIndent(), myChildrenIndent, null); } else if(myNode.getElementType() == JavaElementType.CODE_BLOCK && child.getElementType() == JavaTokenType.LBRACE && myNode.getTreeParent().getElementType() == JavaElementType.METHOD) { child = composeCodeBlock(result, child, indent, myChildrenIndent, childWrap); } else { child = processChild(result, child, alignmentStrategy, childWrap, indent); } } if(child != null) { child = child.getTreeNext(); } } }