Anonymous avatar Anonymous committed 2979b62

move: added resources option

Comments (0)

Files changed (1)

ropemacs/refactor.py

 
 class Move(Refactoring):
     key = 'v'
+    optionals = {
+        'resources': dialog.Data('Files to apply this refactoring on: ')}
 
     def _create_refactoring(self):
         self.mover = rope.refactor.move.create_move(self.project,
 
     def _calculate_changes(self, values, task_handle):
         destination = values['destination']
+        resources = _resources(self.project, values.get('resources', None))
         if isinstance(self.mover, rope.refactor.move.MoveGlobal):
-            return self._move_global(destination, task_handle)
+            return self._move_global(destination, resources, task_handle)
         if isinstance(self.mover, rope.refactor.move.MoveModule):
-            return self._move_module(destination, task_handle)
+            return self._move_module(destination, resources, task_handle)
         if isinstance(self.mover, rope.refactor.move.MoveMethod):
-            return self._move_method(destination, task_handle)
+            return self._move_method(destination, resources, task_handle)
 
-    def _move_global(self, dest, handle):
+    def _move_global(self, dest, resources, handle):
         destination = self.project.pycore.find_module(dest)
-        return self.mover.get_changes(destination, task_handle=handle)
+        return self.mover.get_changes(
+            destination, resources=resources, task_handle=handle)
 
-    def _move_method(self, dest, handle):
+    def _move_method(self, dest, resources, handle):
         return self.mover.get_changes(
-            dest, self.mover.get_method_name(), task_handle=handle)
+            dest, self.mover.get_method_name(),
+            resources=resources, task_handle=handle)
 
-    def _move_module(self, dest, handle):
+    def _move_module(self, dest, resources, handle):
         destination = self.project.pycore.find_module(dest)
-        return self.mover.get_changes(destination, task_handle=handle)
+        return self.mover.get_changes(
+            destination, resources=resources, task_handle=handle)
 
     def _get_confs(self):
         if isinstance(self.mover, rope.refactor.move.MoveGlobal):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.