use of com.intellij.psi.PsiReferenceList in project intellij-community by JetBrains.
the class ObscureThrownExceptionsPredicate method satisfiedBy.
@Override
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiReferenceList)) {
return false;
}
final PsiReferenceList throwsList = (PsiReferenceList) element;
if (throwsList.getReferenceElements().length < 2) {
return false;
}
final PsiElement parent = element.getParent();
if (!(parent instanceof PsiMethod)) {
return false;
}
final PsiMethod method = (PsiMethod) parent;
return method.getThrowsList().equals(element);
}
use of com.intellij.psi.PsiReferenceList in project intellij-community by JetBrains.
the class InlineSuperClassRefactoringHandler method inlineElement.
public void inlineElement(final Project project, final Editor editor, final PsiElement element) {
PsiClass superClass = (PsiClass) element;
if (!superClass.getManager().isInProject(superClass)) {
CommonRefactoringUtil.showErrorHint(project, editor, "Cannot inline non-project class", REFACTORING_NAME, null);
return;
}
PsiClass chosen = null;
PsiReference reference = editor != null ? TargetElementUtil.findReference(editor, editor.getCaretModel().getOffset()) : null;
if (reference != null) {
final PsiElement resolve = reference.resolve();
if (resolve == superClass) {
final PsiElement referenceElement = reference.getElement();
if (referenceElement != null) {
final PsiElement parent = referenceElement.getParent();
if (parent instanceof PsiReferenceList) {
final PsiElement gParent = parent.getParent();
if (gParent instanceof PsiClass) {
chosen = (PsiClass) gParent;
}
}
}
}
}
new InlineSuperClassRefactoringDialog(project, superClass, chosen).show();
}
Aggregations