diff -r 2cdb7c48b719 -r 04583cac110f RefactoringRope/ChangeOccurrencesDialog.py --- a/RefactoringRope/ChangeOccurrencesDialog.py Tue Sep 19 18:59:14 2017 +0200 +++ b/RefactoringRope/ChangeOccurrencesDialog.py Tue Sep 19 19:40:18 2017 +0200 @@ -21,21 +21,28 @@ """ Class implementing the Change Occurrences dialog. """ - def __init__(self, refactoring, title, renamer, parent=None): + def __init__(self, refactoring, title, filename, offset, parent=None): """ Constructor @param refactoring reference to the main refactoring object - (Refactoring) - @param title title of the dialog (string) - @param renamer reference to the renamer object - (rope.refactor.rename.Rename) - @param parent reference to the parent widget (QWidget) + @type Refactoring + @param title title of the dialog + @str str + @param filename file name to be worked on + @type str + @param offset offset within file + @type int + @param parent reference to the parent widget + @type QWidget """ RefactoringDialogBase.__init__(self, refactoring, title, parent) self.setupUi(self) - self.__renamer = renamer + self._changeGroupName = "ChangeOccurrences" + + self.__filename = filename + self.__offset = offset self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) self.__okButton.setEnabled(False) @@ -51,7 +58,8 @@ """ Private slot to react to changes of the new name. - @param text text entered into the edit (string) + @param text text entered into the edit + @type str """ self.__okButton.setEnabled(text != "") @@ -60,28 +68,25 @@ """ Private slot to act on the button pressed. - @param button reference to the button pressed (QAbstractButton) + @param button reference to the button pressed + @type QAbstractButton """ if button == self.__previewButton: - self.previewChanges() + self.requestPreview() elif button == self.__okButton: self.applyChanges() - def _calculateChanges(self, handle): + def _calculateChanges(self): """ - Protected method to calculate the changes. - - @param handle reference to the task handle - (rope.base.taskhandle.TaskHandle) - @return reference to the Changes object (rope.base.change.ChangeSet) + Protected method to initiate the calculation of the changes. """ - try: - changes = self.__renamer.get_changes( - self.replaceEdit.text(), - only_calls=self.onlyCallsCheckBox.isChecked(), - reads=self.readsCheckBox.isChecked(), - writes=self.writesCheckBox.isChecked()) - return changes - except Exception as err: - self._refactoring.handleRopeError(err, self._title, handle) - return None + self._refactoring.sendJson("CalculateChangeOccurrencesChanges", { + "ChangeGroup": self._changeGroupName, + "Title": self._title, + "FileName": self.__filename, + "Offset": self.__offset, + "NewName": self.replaceEdit.text(), + "OnlyCalls": self.onlyCallsCheckBox.isChecked(), + "Reads": self.readsCheckBox.isChecked(), + "Writes": self.writesCheckBox.isChecked(), + })