use of com.intellij.psi.PsiMethod 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.PsiMethod in project intellij-community by JetBrains.
the class ExtractClassTest method testPublicVisibility.
public void testPublicVisibility() throws Exception {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(myProject));
assertNotNull("Class Test not found", aClass);
final ArrayList<PsiMethod> methods = new ArrayList<>();
methods.add(aClass.findMethodsByName("foos", false)[0]);
final ArrayList<PsiField> fields = new ArrayList<>();
fields.add(aClass.findFieldByName("myT", false));
final ExtractClassProcessor processor = new ExtractClassProcessor(aClass, fields, methods, new ArrayList<>(), "", null, "Extracted", PsiModifier.PUBLIC, false, Collections.<MemberInfo>emptyList());
processor.run();
LocalFileSystem.getInstance().refresh(false);
FileDocumentManager.getInstance().saveAllDocuments();
});
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class ExtractClassTest method doTestField.
private void doTestField(final String conflicts, final boolean generateGettersSetters) throws Exception {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(myProject));
assertNotNull("Class Test not found", aClass);
final ArrayList<PsiMethod> methods = new ArrayList<>();
final ArrayList<PsiField> fields = new ArrayList<>();
fields.add(aClass.findFieldByName("myT", false));
doTest(aClass, methods, fields, conflicts, generateGettersSetters);
});
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class ExtractClassTest method doTestMethod.
private void doTestMethod(final String methodName, final String conflicts, final String qualifiedName) throws Exception {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass(qualifiedName, GlobalSearchScope.projectScope(myProject));
assertNotNull("Class Test not found", aClass);
final ArrayList<PsiMethod> methods = new ArrayList<>();
methods.add(aClass.findMethodsByName(methodName, false)[0]);
doTest(aClass, methods, new ArrayList<>(), conflicts, false);
});
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class MakeMethodStaticTest method testInnerStaticClassUsed.
public void testInnerStaticClassUsed() throws Exception {
configureByFile("/refactoring/makeMethodStatic/beforeInnerStaticClassUsed.java");
PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED);
assertTrue(element instanceof PsiMethod);
assertFalse(MakeStaticUtil.isParameterNeeded((PsiMethod) element));
}
Aggregations