sqlite - onWillClose => onWillSaveState
This commit is contained in:
parent
6187c66727
commit
5e67c08dab
16 changed files with 21 additions and 21 deletions
|
@ -62,7 +62,7 @@ suite('FindController', () => {
|
|||
serviceCollection.set(IStorageService, {
|
||||
_serviceBrand: undefined,
|
||||
onDidChangeStorage: Event.None,
|
||||
onWillClose: Event.None,
|
||||
onWillSaveState: Event.None,
|
||||
get: (key: string) => queryState[key],
|
||||
getBoolean: (key: string) => !!queryState[key],
|
||||
getInteger: (key: string) => undefined,
|
||||
|
@ -437,7 +437,7 @@ suite('FindController query options persistence', () => {
|
|||
serviceCollection.set(IStorageService, {
|
||||
_serviceBrand: undefined,
|
||||
onDidChangeStorage: Event.None,
|
||||
onWillClose: Event.None,
|
||||
onWillSaveState: Event.None,
|
||||
get: (key: string) => queryState[key],
|
||||
getBoolean: (key: string) => !!queryState[key],
|
||||
getInteger: (key: string) => undefined,
|
||||
|
|
|
@ -62,7 +62,7 @@ suite('Multicursor selection', () => {
|
|||
serviceCollection.set(IStorageService, {
|
||||
_serviceBrand: undefined,
|
||||
onDidChangeStorage: Event.None,
|
||||
onWillClose: Event.None,
|
||||
onWillSaveState: Event.None,
|
||||
get: (key: string) => queryState[key],
|
||||
getBoolean: (key: string) => !!queryState[key],
|
||||
getInteger: (key: string) => undefined,
|
||||
|
|
|
@ -208,7 +208,7 @@ export class SuggestMemories extends Disposable {
|
|||
|
||||
this._setMode(editor.getConfiguration().contribInfo.suggestSelection);
|
||||
this._register(editor.onDidChangeConfiguration(e => e.contribInfo && this._setMode(editor.getConfiguration().contribInfo.suggestSelection)));
|
||||
this._register(_storageService.onWillClose(() => this._saveState()));
|
||||
this._register(_storageService.onWillSaveState(() => this._saveState()));
|
||||
}
|
||||
|
||||
private _setMode(mode: MemMode): void {
|
||||
|
|
|
@ -18,11 +18,11 @@ export interface IStorageService {
|
|||
readonly onDidChangeStorage: Event<IWorkspaceStorageChangeEvent>;
|
||||
|
||||
/**
|
||||
* Emitted when the storage is about to close. This is the right time
|
||||
* Emitted when the storage is about to persist. This is the right time
|
||||
* to persist data to ensure it is stored before the application shuts
|
||||
* down.
|
||||
*/
|
||||
readonly onWillClose: Event<ShutdownReason>;
|
||||
readonly onWillSaveState: Event<ShutdownReason>;
|
||||
|
||||
/**
|
||||
* Retrieve an element stored with the given key from storage. Use
|
||||
|
@ -93,7 +93,7 @@ export const NullStorageService: IStorageService = {
|
|||
_serviceBrand: undefined,
|
||||
|
||||
onDidChangeStorage: Event.None,
|
||||
onWillClose: Event.None,
|
||||
onWillSaveState: Event.None,
|
||||
|
||||
get(key: string, scope: StorageScope, fallbackValue?: string): string | undefined {
|
||||
return fallbackValue;
|
||||
|
|
|
@ -23,7 +23,7 @@ export class StorageService extends Disposable implements IStorageService {
|
|||
get onDidChangeStorage(): Event<IWorkspaceStorageChangeEvent> { return this._onDidChangeStorage.event; }
|
||||
|
||||
private _onWillClose: Emitter<ShutdownReason> = this._register(new Emitter<ShutdownReason>());
|
||||
get onWillClose(): Event<ShutdownReason> { return this._onWillClose.event; }
|
||||
get onWillSaveState(): Event<ShutdownReason> { return this._onWillClose.event; }
|
||||
|
||||
private globalStorage: Storage;
|
||||
private workspaceStorage: Storage;
|
||||
|
@ -106,7 +106,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
|
|||
get onDidChangeStorage(): Event<IWorkspaceStorageChangeEvent> { return this._onDidChangeStorage.event; }
|
||||
|
||||
private _onWillClose: Emitter<ShutdownReason> = this._register(new Emitter<ShutdownReason>());
|
||||
get onWillClose(): Event<ShutdownReason> { return this._onWillClose.event; }
|
||||
get onWillSaveState(): Event<ShutdownReason> { return this._onWillClose.event; }
|
||||
|
||||
private closed: boolean;
|
||||
|
||||
|
@ -123,7 +123,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
|
|||
|
||||
private registerListeners(): void {
|
||||
this._register(this.storageService.onDidChangeStorage(e => this._onDidChangeStorage.fire(e)));
|
||||
this._register(this.storageService.onWillClose(reason => this._onWillClose.fire(reason)));
|
||||
this._register(this.storageService.onWillSaveState(reason => this._onWillClose.fire(reason)));
|
||||
|
||||
const globalKeyMarker = 'storage://global/';
|
||||
this._register(addDisposableListener(window, 'storage', (e: StorageEvent) => {
|
||||
|
|
|
@ -121,7 +121,7 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
|
|||
private registerListeners(): void {
|
||||
this._register(this.themeService.onThemeChange(_ => this.layout()));
|
||||
this._register(this.parts.editor.onDidSizeConstraintsChange(() => this.onDidEditorSizeConstraintsChange()));
|
||||
this._register(this.storageService.onWillClose(() => {
|
||||
this._register(this.storageService.onWillSaveState(() => {
|
||||
this.saveStateScheduler.dispose();
|
||||
this.saveState();
|
||||
}));
|
||||
|
|
|
@ -431,7 +431,7 @@ export class PersistentContributableViewsModel extends ContributableViewsModel {
|
|||
|
||||
this._register(this.onDidAdd(viewDescriptorRefs => this.saveVisibilityStates(viewDescriptorRefs.map(r => r.viewDescriptor))));
|
||||
this._register(this.onDidRemove(viewDescriptorRefs => this.saveVisibilityStates(viewDescriptorRefs.map(r => r.viewDescriptor))));
|
||||
this._register(this.storageService.onWillClose(() => this.saveViewsStates()));
|
||||
this._register(this.storageService.onWillSaveState(() => this.saveViewsStates()));
|
||||
}
|
||||
|
||||
private saveViewsStates(): void {
|
||||
|
|
|
@ -22,7 +22,7 @@ export class Component extends Themable {
|
|||
this.id = id;
|
||||
this.memento = new Memento(this.id, storageService);
|
||||
|
||||
this._register(storageService.onWillClose(() => {
|
||||
this._register(storageService.onWillSaveState(() => {
|
||||
|
||||
// Ask the component to persist state into the memento
|
||||
this.saveState();
|
||||
|
|
|
@ -170,7 +170,7 @@ export class WorkbenchShell extends Disposable {
|
|||
// Warm up font cache information before building up too many dom elements
|
||||
restoreFontInfo(this.storageService);
|
||||
readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getValue('editor'), browser.getZoomLevel()));
|
||||
this._register(this.storageService.onWillClose(() => {
|
||||
this._register(this.storageService.onWillSaveState(() => {
|
||||
saveFontInfo(this.storageService); // Keep font info for next startup around
|
||||
}));
|
||||
|
||||
|
|
|
@ -476,7 +476,7 @@ export class Workbench extends Disposable implements IPartService {
|
|||
private registerListeners(): void {
|
||||
|
||||
// Storage lifecycle
|
||||
this._register(this.storageService.onWillClose(reason => this.saveState(reason)));
|
||||
this._register(this.storageService.onWillSaveState(reason => this.saveState(reason)));
|
||||
|
||||
// Listen to visible editor changes
|
||||
this._register(this.editorService.onDidVisibleEditorsChange(() => this.onDidVisibleEditorsChange()));
|
||||
|
|
|
@ -238,7 +238,7 @@ export class ConfigurationManager implements IConfigurationManager {
|
|||
}
|
||||
}));
|
||||
|
||||
this.toDispose.push(this.storageService.onWillClose(this.saveState, this));
|
||||
this.toDispose.push(this.storageService.onWillSaveState(this.saveState, this));
|
||||
}
|
||||
|
||||
private initLaunches(): void {
|
||||
|
|
|
@ -134,7 +134,7 @@ export class DebugService implements IDebugService {
|
|||
this.viewModel = new ViewModel(contextKeyService);
|
||||
|
||||
this.toDispose.push(this.fileService.onFileChanges(e => this.onFileChanges(e)));
|
||||
this.toDispose.push(this.storageService.onWillClose(this.saveState, this));
|
||||
this.toDispose.push(this.storageService.onWillSaveState(this.saveState, this));
|
||||
this.lifecycleService.onShutdown(this.dispose, this);
|
||||
|
||||
this.toDispose.push(this.broadcastService.onBroadcast(broadcast => {
|
||||
|
|
|
@ -471,7 +471,7 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
|
|||
}
|
||||
|
||||
this._register(this.lifecycleService.onShutdown(() => this.dispose()));
|
||||
this._register(this.storageService.onWillClose(() => this.saveState()));
|
||||
this._register(this.storageService.onWillSaveState(() => this.saveState()));
|
||||
}
|
||||
|
||||
provideTextContent(resource: URI): TPromise<ITextModel> {
|
||||
|
|
|
@ -109,7 +109,7 @@ class CommandsHistory {
|
|||
|
||||
private registerListeners(): void {
|
||||
this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration());
|
||||
once(this.storageService.onWillClose)(() => this.saveState());
|
||||
once(this.storageService.onWillSaveState)(() => this.saveState());
|
||||
}
|
||||
|
||||
private saveState(): void {
|
||||
|
|
|
@ -535,7 +535,7 @@ class TaskService extends Disposable implements ITaskService {
|
|||
}));
|
||||
this._taskRunningState = TASK_RUNNING_STATE.bindTo(contextKeyService);
|
||||
this._register(lifecycleService.onWillShutdown(event => event.veto(this.beforeShutdown())));
|
||||
this._register(storageService.onWillClose(() => this.saveState()));
|
||||
this._register(storageService.onWillSaveState(() => this.saveState()));
|
||||
this._onDidStateChange = this._register(new Emitter());
|
||||
this.registerCommands();
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ export class HistoryService extends Disposable implements IHistoryService {
|
|||
this._register(this.editorService.onDidActiveEditorChange(() => this.onActiveEditorChanged()));
|
||||
this._register(this.editorService.onDidOpenEditorFail(event => this.remove(event.editor)));
|
||||
this._register(this.editorService.onDidCloseEditor(event => this.onEditorClosed(event)));
|
||||
this._register(this.storageService.onWillClose(reason => this.saveState()));
|
||||
this._register(this.storageService.onWillSaveState(reason => this.saveState()));
|
||||
this._register(this.fileService.onFileChanges(event => this.onFileChanges(event)));
|
||||
this._register(this.resourceFilter.onExpressionChange(() => this.handleExcludesChange()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue