mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Revert "actionBar: always dispose action items for now. Debug always recreate focusProcessActionItem"
This reverts commit 742c299891.
This commit is contained in:
@@ -554,7 +554,8 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this.items = lifecycle.dispose(this.items);
|
||||
// Do not dispose action items if they were provided from outside
|
||||
this.items = this.options.actionItemProvider ? [] : lifecycle.dispose(this.items);
|
||||
$(this.actionsList).empty();
|
||||
}
|
||||
|
||||
@@ -669,7 +670,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
|
||||
public dispose(): void {
|
||||
if (this.items !== null) {
|
||||
this.clear();
|
||||
lifecycle.dispose(this.items);
|
||||
}
|
||||
this.items = null;
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
|
||||
|
||||
private isVisible: boolean;
|
||||
private isBuilt: boolean;
|
||||
private focusProcessActionItem: FocusProcessActionItem;
|
||||
|
||||
constructor(
|
||||
@IMessageService private messageService: IMessageService,
|
||||
@@ -78,7 +79,12 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
|
||||
orientation: ActionsOrientation.HORIZONTAL,
|
||||
actionItemProvider: (action: IAction) => {
|
||||
if (action.id === FocusProcessAction.ID) {
|
||||
return this.instantiationService.createInstance(FocusProcessActionItem, action);
|
||||
if (!this.focusProcessActionItem) {
|
||||
this.focusProcessActionItem = this.instantiationService.createInstance(FocusProcessActionItem, action);
|
||||
this.toDispose.push(this.focusProcessActionItem);
|
||||
}
|
||||
|
||||
return this.focusProcessActionItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user