--- a/RefactoringRope/Refactoring.py Sun Jun 28 13:10:14 2015 +0200 +++ b/RefactoringRope/Refactoring.py Sun Jun 28 16:13:55 2015 +0200 @@ -1967,28 +1967,25 @@ self.__ui, title, self.tr("No matching definition found.")) - def gotoDefinition(self): + def gotoDefinition(self, editor): """ Public slot to find the definition for the word at the cursor position and go to it. Note: This is executed upon a mouse click sequence. + + @param editor reference to the calling editor (Editor) """ - aw = e5App().getObject("ViewManager").activeWindow() - - if aw is None: - return - - filename = aw.getFileName() - line, index = aw.getCursorPosition() - offset = self.__getOffset(aw, line, index) + filename = editor.getFileName() + line, index = editor.getCursorPosition() + offset = self.__getOffset(editor, line, index) import rope.contrib.findit resource = rope.base.libutils.path_to_resource( self.__project, filename) try: location = rope.contrib.findit.find_definition( - self.__project, aw.text(), offset, resource) + self.__project, editor.text(), offset, resource) except Exception: # simply ignore them return @@ -1996,6 +1993,9 @@ if location is not None: e5App().getObject("ViewManager").openSourceFile( location.resource.real_path, location.lineno, next=True) + else: + e5App().getObject("UserInterface").statusBar().showMessage( + self.tr('No definition found'), 5000) def __queryImplementations(self): """