

def run(self, current_project_only=True, action='show_history'):
    if (action == 'show_history'):
        self.current_project_only = current_project_only
        if (not self.is_refresh_in_progress()):
            self.history_list = FileHistory().get_history(current_project_only)
            self.current_selected_index = None
            self.group_index = selected_index.window.active_group()
            selected_index = 0
        else:
            FileHistory().debug('Reopening from refresh')
            self.window.focus_group(self.group_index)
            self.clear_refresh_in_progress()
            selected_index = self.current_selected_index
        display_list = []
        for key in ('closed', 'opened'):
            for entry in self.history_list[key]:
                filepath = entry['filename']
                info = [os.path.basename(filepath), os.path.dirname(filepath)]
                if FileHistory().TIMESTAMP_SHOW:
                    if (not os.path.exists(filepath)):
                        stamp = 'file no longer exists'
                    else:
                        (action, timestamp) = FileHistory().get_history_timestamp(entry, key)
                        if (not timestamp):
                            stamp = ''
                        elif bool(FileHistory().TIMESTAMP_RELATIVE):
                            stamp = ('%s ~%s ago' % (action, self.approximate_age(timestamp)))
                        else:
                            stamp = ('%s on %s' % (action, time.strftime(self.TIMESTAMP_FORMAT, timestamp)))
                    info.append(((' ' * 6) + stamp))
                display_list.append(info)
        if (not display_list):
            return
        font_flag = (sublime.MONOSPACE_FONT if FileHistory().USE_MONOSPACE else 0)
        self.__class__.__is_active = True
        if is_ST2:
            self.window.show_quick_panel(display_list, self.open_file, font_flag)
        else:
            self.window.show_quick_panel(display_list, self.open_file, font_flag, on_highlight=self.show_preview, selected_index=selected_index)
        sublime.status_message('[File History] You can quick-open or remove the currently selected entry with `right` and `ctrl/cmd+del` respectively.')
    elif (action == 'open_latest_closed'):
        self.history_list = FileHistory().get_history(current_project_only)
        self.open_file(0)
    elif (action == 'delete_current_entry'):
        FileHistory().delete_current_entry()
        if (not self.current_selected_index):
            return
        self.delete_current_entry()
        self.set_refresh_in_progress()
        sublime.active_window().run_command('hide_overlay')
    elif (action == 'quick_open_current_entry'):
        self.set_refresh_in_progress()
        if (not FileHistory().quick_open_preview(sublime.active_window())):
            self.clear_refresh_in_progress()

dataset/ETHPy150Open FichteFoll/FileHistory/file_history.py OpenRecentlyClosedFileCommand.run/VarMisuse@68/104 `self`->`selected_index`