/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type PackageableElement } from '@finos/legend-graph'; import { type Clazz } from '@finos/legend-shared'; import type { EditorState } from './editor-state/EditorState.js'; import { ElementEditorState } from './editor-state/element-editor-state/ElementEditorState.js'; import type { EditorStore } from './EditorStore.js'; import { TabManagerState, type TabState } from '@finos/legend-lego/application'; import type { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js'; import { EDITOR_TAB_CLOSE_TRIGGER, EDITOR_TAB_OPEN_TRIGGER } from '../../__lib__/LegendStudioTelemetryHelper.js'; export declare class EditorTabManagerState extends TabManagerState { readonly editorStore: EditorStore; currentTab?: EditorState | undefined; tabs: EditorState[]; cachedTabs: { openedTabEditorPaths: string[]; currentTabState: EditorState | undefined; currentTabElementPath: string | undefined; } | undefined; constructor(editorStore: EditorStore); /** * Per-tab dwell accounting for {@link EDITOR_TAB__CLOSE} telemetry. * Keyed by `TabState.uuid`. `activeSince` is set when the tab becomes the * current tab and cleared on switch away; `accumulatedMs` is the total time * the tab held focus. On close we flush any live `activeSince` and emit * the total. The map is pruned on close so it does not leak. */ private tabDwell; private startDwell; private flushDwell; private emitTabClose; setCurrentTab(val: TabState | undefined): void; openTab(tab: TabState, trigger?: EDITOR_TAB_OPEN_TRIGGER): void; closeTab(tab: TabState, trigger?: EDITOR_TAB_CLOSE_TRIGGER): void; closeAllTabs(trigger?: EDITOR_TAB_CLOSE_TRIGGER): void; closeAllOtherTabs(tab: TabState, trigger?: EDITOR_TAB_CLOSE_TRIGGER): void; get dndType(): string; /** * Here we store the element paths of the * elements editors as element paths don't refer to the actual graph. We can find the element * from the new graph that is built by using element path and can reprocess the element editor states. * The other kind of editors we reprocess are file generation editors, we store them as is as they don't * hold any reference to the actual graph. */ cacheAndClose(options?: { cacheGeneration?: boolean; }): void; clearTabCache(): void; getCurrentEditorState(clazz: Clazz): T; createElementEditorState(element: PackageableElement, config?: EditorInitialConfiguration): ElementEditorState | undefined; refreshCurrentEntityDiffViewer(): void; /** * After we do graph processing, we want to recover the tabs * * NOTE: we have to flush old tab states to ensure, we have no reference * to the old graph to avoid memory leak. Here, we only recreate element * editor tabs, and keep special editors open. Some tabs will be closed. * But we **ABSOLUTELY** must never make this behavior customizable by extension * i.e. we should not allow extension control if a tab should be kept open, because * the plugin implementation could accidentally reference older graph and therefore * cause memory issues * * See https://github.com/finos/legend-studio/issues/1713 */ recoverTabs: () => void; findCurrentTab: (tab: EditorState | undefined, tabElementPath: string | undefined) => EditorState | undefined; } //# sourceMappingURL=EditorTabManagerState.d.ts.map