use of com.intellij.psi.PsiTryStatement in project intellij-community by JetBrains.
the class FinallyBlockSelectioner method select.
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
List<TextRange> result = new ArrayList<>();
final PsiElement parent = e.getParent();
if (parent instanceof PsiTryStatement) {
final PsiTryStatement tryStatement = (PsiTryStatement) parent;
final PsiCodeBlock finallyBlock = tryStatement.getFinallyBlock();
if (finallyBlock != null) {
result.add(new TextRange(e.getTextRange().getStartOffset(), finallyBlock.getTextRange().getEndOffset()));
}
}
return result;
}
use of com.intellij.psi.PsiTryStatement in project intellij-community by JetBrains.
the class MoveCatchUpFix method invoke.
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
PsiTryStatement statement = myCatchSection.getTryStatement();
statement.addBefore(myCatchSection, myMoveBeforeSection);
myCatchSection.delete();
}
Aggregations