Anonymous committed eed5cfc

ropeide: asking the user when renaming unsure occurrences

Comments (0)

Files changed (1)


 from ropeide.uihelpers import (TreeViewHandle, TreeView,
                                DescriptionList, EnhancedListHandle,
                                VolatileList, EnhancedList)
+import tkMessageBox
 class PreviewAndCommitChanges(object):
     def __init__(self, project, changes):
     def __init__(self, context, title, is_local=False, current_module=False):
         resource = context.resource
         editor = context.editor
+        self.editors = context.get_core().editor_manager
         super(RenameDialog, self).__init__(context, title)
         self.is_local = is_local
         offset = context.offset
     def _calculate_changes(self, handle=None):
         new_name = self.new_name_entry.get()
         return self.renamer.get_changes(
-            new_name, in_file=self.is_local,
+            new_name, in_file=self.is_local,, 
             in_hierarchy=self.in_hierarchy.get(), unsure=self.unsure.get(),
-  , task_handle=handle)
+            confirm=self._confirm_occurrence, task_handle=handle)
+    def _confirm_occurrence(self, occurrence):
+        resource = occurrence.resource
+        start, end = occurrence.get_primary_range()
+        editor = self.editors.get_resource_editor(resource).editor
+        start_index = editor.get_index(start)
+        end_index = editor.get_index(end)
+        editor.select_range(start_index, end_index)
+        return tkMessageBox.askyesno('Matches?', 'Is this a match?')
     def _get_dialog_frame(self):
         frame = Tkinter.Frame(self.toplevel)
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
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.