def generate(self, *args):
     # The idea is to just do this, but it seems to cause strange things to happen
     # internally. So we do it outside SWTBot instead.
     # self.widget.setFocus()
     page = self.widget.getViewReference().getPage()
     view = self.widget.getViewReference().getView(False)
     swtsimulator.runOnUIThread(page.activate, view)
    def connectRecord(self, method):
        class RecordListener(IPartListener):
            def partActivated(listenerSelf, part):
                method(part, self)

        page = self.widget.getViewReference().getPage()
        swtsimulator.runOnUIThread(page.addPartListener, RecordListener())
 def monitorAllWidgets(self, *args, **kw):
     WidgetAdapter.setAdapterClass(WidgetAdapter)
     swtsimulator.runOnUIThread(self.cacheAndMonitorViews)
     swtsimulator.WidgetMonitor.monitorAllWidgets(self, *args, **kw)