Commits

Anonymous committed 83fbb99

rope-find-implementations: was added

Comments (0)

Files changed (1)

ropemacs/interface.py

         if docs is None:
             lisputils.message('No docs avilable!')
 
-    @decorators.local_command('a f', shortcut='C-c f')
-    def find_occurrences(self):
+    def _base_findit(self, optionals, do_find):
         self._check_project()
         self._save_buffers()
         resource, offset = self._get_location()
 
-        optionals = {
-            'unsure': dialog.Data('Find uncertain occurrences: ',
-                                           default='no', values=['yes', 'no']),
-            'resources': dialog.Data('Files to search: '),
-            'in_hierarchy': dialog.Data(
-                    'Rename methods in class hierarchy: ',
-                    default='no', values=['yes', 'no'])}
         action, values = dialog.show_dialog(
             lisputils.askdata, ['search', 'cancel'], optionals=optionals)
         if action == 'search':
-            unsure = values.get('unsure') == 'yes'
-            hier = values.get('in_hierarchy') == 'yes'
-            resources = refactor._resources(self.project,
-                                            values.get('resources'))
             def calculate(handle):
-                return findit.find_occurrences(
-                    self.project, resource, offset, unsure=unsure,
-                    resources=resources, in_hierarchy=hier, task_handle=handle)
+                return do_find(resource, offset, values, handle)
             result = lisputils.runtask(calculate, 'Find Occurrences')
             text = []
             for occurrence in result:
             lisp.local_set_key('\r', lisp.rope_occurrences_goto_occurrence)
             lisp.local_set_key('q', lisp.rope_occurrences_quit)
 
+    @decorators.local_command('a f', shortcut='C-c f')
+    def find_occurrences(self):
+        optionals = {
+            'unsure': dialog.Data('Find uncertain occurrences: ',
+                                           default='no', values=['yes', 'no']),
+            'resources': dialog.Data('Files to search: '),
+            'in_hierarchy': dialog.Data(
+                    'Rename methods in class hierarchy: ',
+                    default='no', values=['yes', 'no'])}
+        def do_find(resource, offset, values, handle):
+            unsure = values.get('unsure') == 'yes'
+            hier = values.get('in_hierarchy') == 'yes'
+            resources = refactor._resources(self.project,
+                                            values.get('resources'))
+            return findit.find_occurrences(
+                self.project, resource, offset, unsure=unsure,
+                resources=resources, in_hierarchy=hier, task_handle=handle)
+        self._base_findit(optionals, do_find)
+
+    @decorators.local_command('a i')
+    def find_implementations(self):
+        optionals = {'resources': dialog.Data('Files to search: ')}
+        def do_find(resource, offset, values, handle):
+            resources = refactor._resources(self.project,
+                                            values.get('resources'))
+            return findit.find_implementations(
+                self.project, resource, offset,
+                resources=resources, task_handle=handle)
+        self._base_findit(optionals, do_find)
 
     @decorators.interactive
     def occurrences_goto_occurrence(self):
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.