'use babel';

import { SelectListView } from 'atom-space-pen-views';

export default class ChangeThemeView extends SelectListView {

  constructor(themeManager) {
    super();
    this.modal = atom.workspace.addModalPanel({
      item: this,
      visible: false
    });
    this.addClass('overlay from-top');
    this.list.addClass('mark-active');

    this.themeManager = themeManager;
  }

  changeTheme() {
    this.setItems(this.themeManager.getThemeNames());
    this.modal.show();
    this.focus();
  }

  viewForItem(theme) {
    let el = document.createElement('li');
    el.textContent = theme;
    return el;
  }

  confirmed(theme) {
    this.themeManager.loadTheme(theme);
    this.modal.hide();
  }

  cancel() {
    super.cancel();
    this.modal.hide();
  }

  destroy() {
    this.modal.destroy();
  }
}

@@ -495,16 +495,28 @@
 is.focus
+FilterEditor
 ();%0A  %7D%0A

Maintain focus in change theme list view