destroy: function() { this._plugins.forEach(plugin => { plugin.destroy(); }); forget(this, this.projectTree); this.projectTree.destroy(); this.projectTree = null; this.shells.destroy(); forget(this, this.project); this.project.destroy(); this.project = null; },
removeLocalStore: function(store) { // XXX: tree selection should be reset if active element is affected by // the store being removed if (store) { this.localStores.delete(store.path); forget(this, store); emit(this, "store-removed", store); store.destroy(); } }
destroy: function() { this._destroyed = true; // If been destroyed before the iframe finished loading, then // the properties below will not exist. if (!this._loaded) { this.iframe.setAttribute("src", "about:blank"); return; } // Reset the src for the iframe so if it reused for a new ProjectEditor // instance, the load will fire properly. this.window.removeEventListener("unload", this.destroy, false); this.iframe.setAttribute("src", "about:blank"); this._plugins.forEach(plugin => { plugin.destroy(); }); forget(this, this.projectTree); this.projectTree.destroy(); this.projectTree = null; this.shells.destroy(); this.projectEditorCommandset.remove(); this.projectEditorKeyset.remove(); this.editorCommandset.remove(); this.editorKeyset.remove(); this.contextMenuPopup.remove(); this.textEditorContextMenuPopup.remove(); this.editMenu.remove(); this.fileMenu.remove(); this._commandWindow.controllers.removeController(this._commandController); this._commandController = null; forget(this, this.project); this.project.destroy(); this.project = null; },
setProject: function(project) { if (this.project) { forget(this, this.project); } this.project = project; this.projectTree.setProject(project); // Whenever a store gets removed, clean up any editors that // exist for resources within it. on(this, project, "store-removed", (store) => { store.allResources().forEach((resource) => { this.shells.removeResource(resource); }); }); },
destroy: function() { this._plugins.forEach(plugin => { plugin.destroy(); }); this.project.allResources().forEach((resource) => { let editor = this.editorFor(resource); if (editor) { editor.destroy(); } }); forget(this, this.project); this.project.destroy(); this.project = null; this.projectTree.destroy(); this.projectTree = null; },
setProject: function(project) { if (this.project) { forget(this, this.project); } this.project = project; this.projectTree.setProject(project); // Whenever a store gets removed, clean up any editors that // exist for resources within it. on(this, project, "store-removed", (store) => { store.allResources().forEach((resource) => { let editor = this.editorFor(resource); if (editor) { editor.destroy(); } }); }); },