use of org.jetbrains.plugins.groovy.lang.psi.api.types.GrDisjunctionTypeElement in project intellij-community by JetBrains.
the class GrRemoveExceptionFix method findTypeElementInDisjunction.
@Nullable
private static GrTypeElement findTypeElementInDisjunction(Editor editor, PsiFile file) {
final int offset = editor.getCaretModel().getOffset();
final PsiElement at = file.findElementAt(offset);
final GrDisjunctionTypeElement disjunction = PsiTreeUtil.getParentOfType(at, GrDisjunctionTypeElement.class);
if (disjunction == null)
return null;
for (GrTypeElement element : disjunction.getTypeElements()) {
if (element.getTextRange().contains(offset)) {
return element;
}
}
return null;
}
Aggregations