rename: remember 'Search for text occurrences' checkbox state (IDEA-21328)
authoranna <anna.kozlova@jetbrains.com>
Fri, 12 Feb 2010 11:20:20 +0000 (12 14:20 +0300)
committeranna <anna.kozlova@jetbrains.com>
Fri, 12 Feb 2010 15:57:10 +0000 (12 18:57 +0300)
java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
java/java-impl/src/com/intellij/refactoring/rename/RenameJavaMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/rename/RenameJavaVariableProcessor.java

index 8257f97..f61f70c 100644 (file)
@@ -41,6 +41,9 @@ public class JavaRefactoringSettings implements PersistentStateComponent<JavaRef
 
   public boolean RENAME_SEARCH_FOR_TEXT_FOR_PACKAGE = true;
   public boolean RENAME_SEARCH_FOR_TEXT_FOR_CLASS = true;
+  public boolean RENAME_SEARCH_FOR_TEXT_FOR_METHOD = true;
+  public boolean RENAME_SEARCH_FOR_TEXT_FOR_FIELD = true;
+  public boolean RENAME_SEARCH_FOR_TEXT_FOR_VARIABLE = true;
 
   //public boolean ENCAPSULATE_FIELDS_PREVIEW_USAGES = true;
   public boolean ENCAPSULATE_FIELDS_USE_ACCESSORS_WHEN_ACCESSIBLE = true;
index 4b1f85c..06b9d30 100644 (file)
@@ -235,4 +235,12 @@ public class RenameJavaMethodProcessor extends RenameJavaMemberProcessor {
       }
     }
   }
+
+   public boolean isToSearchForTextOccurrences(final PsiElement element) {
+    return JavaRefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_METHOD;
+  }
+
+  public void setToSearchForTextOccurrences(final PsiElement element, final boolean enabled) {
+    JavaRefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_METHOD = enabled;
+  }
 }
index 967825a..4bc6ba3 100644 (file)
@@ -281,6 +281,20 @@ public class RenameJavaVariableProcessor extends RenameJavaMemberProcessor {
     JavaRefactoringSettings.getInstance().RENAME_SEARCH_IN_COMMENTS_FOR_VARIABLE = enabled;
   }
 
+  public boolean isToSearchForTextOccurrences(final PsiElement element) {
+    if (element instanceof PsiField) {
+      return JavaRefactoringSettings.getInstance().RENAME_SEARCH_IN_COMMENTS_FOR_FIELD;
+    }
+    return JavaRefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_VARIABLE;
+  }
+
+  public void setToSearchForTextOccurrences(final PsiElement element, final boolean enabled) {
+    if (element instanceof PsiField) {
+      JavaRefactoringSettings.getInstance().RENAME_SEARCH_IN_COMMENTS_FOR_FIELD = enabled;
+    }
+    JavaRefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_VARIABLE = enabled;
+  }
+
   private static void findSubmemberHidesFieldCollisions(final PsiField field, final String newName, final List<UsageInfo> result) {
     if (field.getContainingClass() == null) return;
     if (field.hasModifierProperty(PsiModifier.PRIVATE)) return;