Commits

Ali Gholami Rudi  committed a90816f

usefunction: added usefunction refactoring

  • Participants
  • Parent commits 2ddf6d0

Comments (0)

Files changed (1)

File ropemacs/refactor.py

 import rope.refactor.move
 import rope.refactor.rename
 import rope.refactor.restructure
+import rope.refactor.usefunction
 
 from ropemacs import dialog, lisputils
 
                                          task_handle=task_handle)
 
 
+class Restructure(Refactoring):
+    key = 'u'
+    optionals = {
+        'resources': dialog.Data('Files to apply this restructuring: ')}
+
+    def _calculate_changes(self, values, task_handle):
+        resources = _resources(self.project, values.get('resources', None))
+        user = rope.refactor.usefunction.UseFunction(
+            self.project, self.resource, self.offset)
+        return user.get_changes(resources=resources,
+                                task_handle=task_handle)
+
+
 class Move(Refactoring):
     key = 'v'
     optionals = {