code: def findinfiles_callback(self):
          
          widget = QApplication.focusWidget()
          if not self.ismaximized:
              self.dockwidget.setVisible(True)
              self.dockwidget.raise_()
          text = ''
          try:
              if widget.has_selected_text():
                  text = widget.get_selected_text()
          except AttributeError:
              # This is not a text widget deriving from TextEditBaseWidget
              pass
          self.findinfiles.set_search_text(text)
          if text:
              self.findinfiles.find()
docs: Find in files callback