PY-17265 Simplify PyMoveModuleMembersProcessor's constructor similarly to PyBaseMakeF...
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Wed, 21 Oct 2015 10:01:50 +0000 (13:01 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Mon, 24 Oct 2016 21:03:49 +0000 (00:03 +0300)
python/src/com/jetbrains/python/refactoring/move/PyMoveSymbolDelegate.java
python/src/com/jetbrains/python/refactoring/move/moduleMembers/PyMoveModuleMembersProcessor.java
python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java

index 1fb9b8c77747e315d94a962b368f4f1b81bff3b0..8506665181f821d33301b6d07d857c1edc9b95bf 100644 (file)
@@ -115,9 +115,9 @@ public class PyMoveSymbolDelegate extends MoveHandlerDelegate {
       if (!dialog.showAndGet()) {
         return;
       }
-      final boolean previewUsages = dialog.isPreviewUsages();
       final PsiNamedElement[] selectedElements = ContainerUtil.findAllAsArray(dialog.getSelectedTopLevelSymbols(), PsiNamedElement.class);
-      processor = new PyMoveModuleMembersProcessor(project, selectedElements, dialog.getTargetPath(), previewUsages);
+      processor = new PyMoveModuleMembersProcessor(selectedElements, dialog.getTargetPath());
+      processor.setPreviewUsages(dialog.isPreviewUsages());
     }
     
     try {
index 93014758a5e814eb9d6915f0d26ef4c07ff4e35c..8531fc612b3fb87572cf99068ed551d9955b4ff6 100644 (file)
@@ -17,7 +17,6 @@ package com.jetbrains.python.refactoring.move.moduleMembers;
 
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
-import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiNamedElement;
@@ -55,12 +54,10 @@ public class PyMoveModuleMembersProcessor extends BaseRefactoringProcessor {
   private final PsiNamedElement[] myElements;
   private final String myDestination;
 
-  public PyMoveModuleMembersProcessor(Project project, PsiNamedElement[] elements, String destination, boolean previewUsages) {
-    super(project);
-    assert elements.length > 0;
+  public PyMoveModuleMembersProcessor(@NotNull PsiNamedElement[] elements, @NotNull String destination) {
+    super(elements[0].getProject());
     myElements = elements;
     myDestination = destination;
-    setPreviewUsages(previewUsages);
   }
 
   @NotNull
index 6b53b1c7062ceea1803859d5e3ce8ff63ddf93af..f336bb5e99d25459f15ca09705e2f99cee60bad8 100644 (file)
@@ -403,10 +403,7 @@ public class PyMoveTest extends PyTestCase {
 
     VirtualFile toVirtualFile = dir1.findFileByRelativePath(toFileName);
     String path = toVirtualFile != null ? toVirtualFile.getPath() : (dir1.getPath() + "/" + toFileName);
-    new PyMoveModuleMembersProcessor(myFixture.getProject(),
-                                     symbols,
-                                     path,
-                                     false).run();
+    new PyMoveModuleMembersProcessor(symbols, path).run();
 
     VirtualFile dir2 = getVirtualFileByName(PythonTestUtil.getTestDataPath() + rootAfter);
     try {