1003 return |
1003 return |
1004 |
1004 |
1005 filename = aw.getFileName() |
1005 filename = aw.getFileName() |
1006 if renameModule: |
1006 if renameModule: |
1007 offset = None |
1007 offset = None |
|
1008 selectedText, _ = os.path.splitext(os.path.basename(filename)) |
1008 else: |
1009 else: |
1009 line, index, line1, index1 = aw.getSelection() |
1010 line, index, line1, index1 = aw.getSelection() |
1010 if line != line1: |
1011 if line != line1: |
1011 # selection span more than one line |
1012 # selection span more than one line |
1012 E5MessageBox.warning( |
1013 E5MessageBox.warning( |
1015 " one line.")) |
1016 " one line.")) |
1016 return |
1017 return |
1017 index = int(index + (index1 - index) / 2) |
1018 index = int(index + (index1 - index) / 2) |
1018 # keep it inside the object |
1019 # keep it inside the object |
1019 offset = self.__getOffset(aw, line, index) |
1020 offset = self.__getOffset(aw, line, index) |
|
1021 selectedText = aw.selectedText() |
1020 |
1022 |
1021 import rope.refactor.rename |
1023 import rope.refactor.rename |
1022 resource = rope.base.libutils.path_to_resource( |
1024 resource = rope.base.libutils.path_to_resource( |
1023 self.__project, filename) |
1025 self.__project, filename) |
1024 try: |
1026 try: |
1032 localResource = resource |
1034 localResource = resource |
1033 else: |
1035 else: |
1034 localResource = None |
1036 localResource = None |
1035 from RenameDialog import RenameDialog |
1037 from RenameDialog import RenameDialog |
1036 self.dlg = RenameDialog(self, title, renamer, resource=localResource, |
1038 self.dlg = RenameDialog(self, title, renamer, resource=localResource, |
1037 parent=self.__ui) |
1039 selectedText=selectedText, parent=self.__ui) |
1038 self.dlg.show() |
1040 self.dlg.show() |
1039 |
1041 |
1040 def __changeOccurrences(self): |
1042 def __changeOccurrences(self): |
1041 """ |
1043 """ |
1042 Private slot to perform the Change Occurrences refactoring. |
1044 Private slot to perform the Change Occurrences refactoring. |