if there aren't any physical accessors for groovy property, search for them anyway
authorpeter <peter.gromov@jetbrains.com>
Sun, 14 Feb 2010 21:30:44 +0000 (14 21:30 +0000)
committerpeter <peter.gromov@jetbrains.com>
Sun, 14 Feb 2010 21:30:44 +0000 (14 21:30 +0000)
java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java

index 752d467..59a0e5b 100644 (file)
@@ -172,11 +172,17 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
         PsiMethod setter = PropertyUtil.
           findPropertySetterWithType(propertyName, field.hasModifierProperty(PsiModifier.STATIC), field.getType(),
                                      ContainerUtil.iterate(containingClass.getMethods()));
-        if (getter != null && getter.isPhysical() || setter != null && setter.isPhysical()) {
-          if (Messages.showDialog(FindBundle.message("find.field.accessors.prompt", field.getName()),
-                                  FindBundle.message("find.field.accessors.title"),
-                                  new String[]{CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()}, 0,
-                                  Messages.getQuestionIcon()) == DialogWrapper.OK_EXIT_CODE) {
+        if (getter != null || setter != null) {
+          final boolean doSearch;
+          if ((getter == null || !getter.isPhysical()) && (setter == null || !setter.isPhysical())) {
+            doSearch = true;
+          } else {
+            doSearch = Messages.showDialog(FindBundle.message("find.field.accessors.prompt", field.getName()),
+                                           FindBundle.message("find.field.accessors.title"),
+                                           new String[]{CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()}, 0,
+                                           Messages.getQuestionIcon()) == DialogWrapper.OK_EXIT_CODE;
+          }
+          if (doSearch) {
             final List<PsiElement> elements = new ArrayList<PsiElement>();
             if (getter != null) {
               elements.addAll(Arrays.asList(SuperMethodWarningUtil.checkSuperMethods(getter, ACTION_STRING)));