def run(self, application):
        """
        Run this runnable.

        Overridden here to: (a) ensure the UI service monitors for the
        closing of the application, and (b) restore the last opened
        project.

        """

        # Ensure our UI service is listening for the application to close.
        # FIXME: This ugly hack (doing this here) is necessary only because
        # this plugin contributes to the workbench plugin and that means the
        # workbench insists on starting us first which means our UI service
        # can't directly reference the workbench service until after
        # everything has been started.
        ui_service = application.get_service(IPROJECT_UI)
        ui_service.listen_for_application_exit()

        # Load the project we were using when we last shutdown.
        model_service = application.get_service(IPROJECT_MODEL)
        location = model_service.preferences.get('project location',
            default=None)
        if location and len(location) > 0:
            logger.info("Opening last project from location [%s]", location)

            try:
                project = model_service.factory.open(location)
            except:
                logger.exception('Error during opening of last project.')
                project = None

            if project is not None:
                model_service.project = project
            else:
                information(self._get_parent_window(application),
                    'Unable to open last project from location:\t\n'
                    '\t%s\n'  % (location) + '\n\n'
                    'The project may no longer exist.',
                    'Can Not Open Last Project',
                    )

        else:
            logger.info('No previous project to open')

        return


    #### protected interface ################################################
dataset/ETHPy150Open enthought/envisage/envisage/ui/single_project/project_runnable.py/ProjectRunnable.run/original