setActiveTab = (tab) => {
        currentTab = tab;
        currentGenerate = tab.generate;
        const isXml = tab.state.name == 'XML';
        const isJson = tab.state.name == 'JSON';
        editor.setModel(currentTab.state.model);
        editor.updateOptions({
          readOnly: !isXml && !isJson,
          wordWrap: false,
        });

        // Update tab UI.
        Object.values(tabs).forEach(
          (t) =>
            (t.tabElement.style.background =
              t.tabElement == tab.tabElement ? '#1E1E1E' : '#2D2D2D'),
        );
        // Update editor state.
        editorXmlContextKey.set(isXml);
        editorJsonContextKey.set(isJson);
        updateImportButtonDisplay();
        playgroundState.set('activeTab', tab.state.name);
        playgroundState.save();
      }
Set the active tab.
@param {!PlaygroundTab} tab The new tab.