use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class GrChangeSignatureHandler method invoke.
private static void invoke(PsiMethod method, final Project project) {
if (!CommonRefactoringUtil.checkReadOnlyStatus(project, method))
return;
if (method instanceof GrReflectedMethod)
method = ((GrReflectedMethod) method).getBaseMethod();
PsiMethod newMethod = SuperMethodWarningUtil.checkSuperMethod(method, RefactoringBundle.message("to.refactor"));
if (newMethod == null)
return;
if (!newMethod.equals(method)) {
ChangeSignatureUtil.invokeChangeSignatureOn(newMethod, project);
return;
}
if (!CommonRefactoringUtil.checkReadOnlyStatus(project, method))
return;
//todo
if (!(method instanceof GrMethod))
return;
final GrChangeSignatureDialog dialog = new GrChangeSignatureDialog(project, new GrMethodDescriptor((GrMethod) method), true, null);
dialog.show();
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class GrMemberSelectionTable method getOverrideIcon.
@Override
protected Icon getOverrideIcon(GrMemberInfo memberInfo) {
PsiMember member = memberInfo.getMember();
Icon overrideIcon = EMPTY_OVERRIDE_ICON;
if (member instanceof PsiMethod) {
if (Boolean.TRUE.equals(memberInfo.getOverrides())) {
overrideIcon = AllIcons.General.OverridingMethod;
} else if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
overrideIcon = AllIcons.General.ImplementingMethod;
} else {
overrideIcon = EMPTY_OVERRIDE_ICON;
}
}
return overrideIcon;
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class ClassGenerator method shouldBeGenerated.
private static boolean shouldBeGenerated(PsiMethod method) {
for (PsiMethod psiMethod : method.findSuperMethods()) {
if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
final PsiType type = method.getReturnType();
final PsiType superType = psiMethod.getReturnType();
if (type != null && superType != null && !superType.isAssignableFrom(type)) {
return false;
}
}
}
return true;
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class GrChangeSignatureHandler method findTargetMember.
@Override
@Nullable
public PsiElement findTargetMember(PsiElement element) {
final GrParameterList parameterList = PsiTreeUtil.getParentOfType(element, GrParameterList.class);
if (parameterList != null) {
final PsiElement parent = parameterList.getParent();
if (parent instanceof PsiMethod)
return parent;
}
if (element.getParent() instanceof GrMethod && ((GrMethod) element.getParent()).getNameIdentifierGroovy() == element) {
return element.getParent();
}
final GrCall expression = PsiTreeUtil.getParentOfType(element, GrCall.class);
if (expression != null) {
return expression.resolveMethod();
}
final PsiReference ref = element.getReference();
if (ref == null)
return null;
return ref.resolve();
}
use of com.intellij.psi.PsiMethod in project intellij-community by JetBrains.
the class JavaFXRenameTest method testStaticPropertyMethod.
public void testStaticPropertyMethod() throws Exception {
final String className = "container.MyCustomContainer";
final String methodName = "setStaticProp";
final String newName = "setNewMethodName";
myFixture.configureByFiles(getTestName(true) + ".fxml", className.replace('.', '/') + ".java");
final PsiClass psiClass = myFixture.findClass(className);
assertNotNull(psiClass);
final PsiMethod[] methods = psiClass.findMethodsByName(methodName, false);
assertEquals(1, methods.length);
final PsiMethod method = methods[0];
final RenameRefactoring rename = new JavaRenameRefactoringImpl(getProject(), method, newName, false, false);
rename.run();
myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
assertMethodExists(psiClass, newName);
}
Aggregations