resource bundle editor copy search whole project content for target RB-s IDEA-159110
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 9 Aug 2016 16:25:31 +0000 (19:25 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 9 Aug 2016 16:28:47 +0000 (19:28 +0300)
plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/BundleNameEvaluator.java
plugins/properties/src/com/intellij/lang/properties/editor/PropertiesCopyHandler.java

index 923a48b9c9285389c69f9afd25fa5e51393222d6..c0adcb777deefc903893b2f7b83cecbc533ce741 100644 (file)
@@ -43,6 +43,13 @@ public interface BundleNameEvaluator {
     }
   };
 
+  BundleNameEvaluator BASE_NAME = new BundleNameEvaluator() {
+    @Nullable
+    public String evaluateBundleName(final PsiFile psiFile) {
+      return ResourceBundleManager.getInstance(psiFile.getProject()).getBaseName(psiFile);
+    }
+  };
+
   @Nullable
   String evaluateBundleName(PsiFile psiFile);
 }
index 592f1c99ba9cd0073679d5456e52d1132258954d..5137a2ab111a9220a8378829b755ca670e0d1cc7 100644 (file)
@@ -42,7 +42,7 @@ import com.intellij.psi.PsiFileSystemItem;
 import com.intellij.psi.PsiManager;
 import com.intellij.psi.impl.SyntheticFileSystemItem;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.GlobalSearchScopesCore;
+import com.intellij.psi.search.ProjectScope;
 import com.intellij.psi.search.PsiElementProcessor;
 import com.intellij.refactoring.copy.CopyHandlerDelegateBase;
 import com.intellij.ui.ComboboxSpeedSearch;
@@ -238,7 +238,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase {
 
       final Collection<PropertiesFile> propertiesFiles = new ArrayList<>();
 
-      GlobalSearchScope searchScope = GlobalSearchScopesCore.projectProductionScope(myProject).union(GlobalSearchScopesCore.projectTestScope(myProject));
+      GlobalSearchScope searchScope = ProjectScope.getContentScope(myProject);
       PropertiesReferenceManager
         .getInstance(myProject)
         .processPropertiesFiles(searchScope,
@@ -248,7 +248,7 @@ public class PropertiesCopyHandler extends CopyHandlerDelegateBase {
                                     propertiesFiles.add(propertiesFile);
                                     return true;
                                   }
-                                }, BundleNameEvaluator.DEFAULT);
+                                }, BundleNameEvaluator.BASE_NAME);
 
       final List<PsiFileSystemItem> resourceBundlesAsFileSystemItems = propertiesFiles
         .stream()