mirror of
https://github.com/Microsoft/vscode
synced 2024-09-29 16:01:05 +00:00
SCM - use MutableDisposable in SCMInputWidgetToolbar (#221173)
This commit is contained in:
parent
1e6b49798d
commit
e86f5306cc
|
@ -2179,7 +2179,7 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
|
|||
private _onDidChange = new Emitter<void>();
|
||||
readonly onDidChange: Event<void> = this._onDidChange.event;
|
||||
|
||||
private readonly repositoryDisposables = new DisposableStore();
|
||||
private readonly _disposables = this._register(new MutableDisposable<DisposableStore>());
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
|
@ -2207,7 +2207,7 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
|
|||
}
|
||||
|
||||
public setInput(input: ISCMInput): void {
|
||||
this.repositoryDisposables.clear();
|
||||
this._disposables.value = new DisposableStore();
|
||||
|
||||
const contextKeyService = this.contextKeyService.createOverlay([
|
||||
['scmProvider', input.repository.provider.contextValue],
|
||||
|
@ -2215,7 +2215,7 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
|
|||
['scmProviderHasRootUri', !!input.repository.provider.rootUri]
|
||||
]);
|
||||
|
||||
const menu = this.repositoryDisposables.add(this.menuService.createMenu(MenuId.SCMInputBox, contextKeyService, { emitEventsForSubmenuChanges: true }));
|
||||
const menu = this._disposables.value.add(this.menuService.createMenu(MenuId.SCMInputBox, contextKeyService, { emitEventsForSubmenuChanges: true }));
|
||||
|
||||
const isEnabled = (): boolean => {
|
||||
return input.repository.provider.groups.some(g => g.resources.length > 0);
|
||||
|
@ -2245,18 +2245,18 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
|
|||
this._onDidChange.fire();
|
||||
};
|
||||
|
||||
this.repositoryDisposables.add(menu.onDidChange(() => updateToolbar()));
|
||||
this.repositoryDisposables.add(input.repository.provider.onDidChangeResources(() => updateToolbar()));
|
||||
this.repositoryDisposables.add(this.storageService.onDidChangeValue(StorageScope.PROFILE, SCMInputWidgetStorageKey.LastActionId, this.repositoryDisposables)(() => updateToolbar()));
|
||||
this._disposables.value.add(menu.onDidChange(() => updateToolbar()));
|
||||
this._disposables.value.add(input.repository.provider.onDidChangeResources(() => updateToolbar()));
|
||||
this._disposables.value.add(this.storageService.onDidChangeValue(StorageScope.PROFILE, SCMInputWidgetStorageKey.LastActionId, this._disposables.value)(() => updateToolbar()));
|
||||
|
||||
this.actionRunner = new SCMInputWidgetActionRunner(input, this.storageService);
|
||||
this.repositoryDisposables.add(this.actionRunner.onWillRun(e => {
|
||||
this._disposables.value.add(this.actionRunner.onWillRun(e => {
|
||||
if ((this.actionRunner as SCMInputWidgetActionRunner).runningActions.size === 0) {
|
||||
super.setActions([this._cancelAction], []);
|
||||
this._onDidChange.fire();
|
||||
}
|
||||
}));
|
||||
this.repositoryDisposables.add(this.actionRunner.onDidRun(e => {
|
||||
this._disposables.value.add(this.actionRunner.onDidRun(e => {
|
||||
if ((this.actionRunner as SCMInputWidgetActionRunner).runningActions.size === 0) {
|
||||
updateToolbar();
|
||||
}
|
||||
|
@ -2264,11 +2264,6 @@ class SCMInputWidgetToolbar extends WorkbenchToolBar {
|
|||
|
||||
updateToolbar();
|
||||
}
|
||||
|
||||
override dispose(): void {
|
||||
this.repositoryDisposables.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class SCMInputWidgetEditorOptions {
|
||||
|
|
Loading…
Reference in a new issue