String (PsiLocalVariable variable) { String place = JavaBundle.message("completion.inner.scope"); PsiCodeBlock block = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class); PsiElement statement = block == null ? null : block.getParent(); if (statement instanceof PsiTryStatement) { place = ((PsiTryStatement)statement).getFinallyBlock() == block ? PsiKeyword.TRY + "-" + PsiKeyword.FINALLY : PsiKeyword.TRY; } else if (statement instanceof PsiCatchSection) { place = PsiKeyword.CATCH; } else if (statement instanceof PsiSynchronizedStatement) { place = PsiKeyword.SYNCHRONIZED; } else if (statement instanceof PsiBlockStatement) { PsiElement parent = statement.getParent(); if (parent instanceof PsiWhileStatement) { place = PsiKeyword.WHILE; } else if (parent instanceof PsiIfStatement) { place = ((PsiIfStatement)parent).getThenBranch() == statement ? PsiKeyword.IF + "-then" : PsiKeyword.IF + "-" + PsiKeyword.ELSE; } } return place; }