提交 e8f7ac78 编写于 作者: B Benjamin Pasero

💄

上级 156de5ea
......@@ -40,7 +40,6 @@ export class StatusbarPart extends Part implements IStatusbarService {
private static PRIORITY_PROP = 'priority';
private static ALIGNMENT_PROP = 'alignment';
private toDispose: IDisposable[];
private statusItemsContainer: Builder;
private statusMsgDispose: IDisposable;
......@@ -52,7 +51,11 @@ export class StatusbarPart extends Part implements IStatusbarService {
) {
super(id, { hasTitle: false }, themeService);
this.toDispose = [];
this.registerListeners();
}
private registerListeners(): void {
this.toUnbind.push(this.contextService.onDidChangeWorkspaceRoots(() => this.updateStyles()));
}
public addEntry(entry: IStatusbarEntry, alignment: StatusbarAlignment, priority: number = 0): IDisposable {
......@@ -120,7 +123,7 @@ export class StatusbarPart extends Part implements IStatusbarService {
const descriptors = rightDescriptors.concat(leftDescriptors); // right first because they float
this.toDispose.push(...descriptors.map(descriptor => {
this.toUnbind.push(...descriptors.map(descriptor => {
const item = this.instantiationService.createInstance(descriptor.syncDescriptor);
const el = this.doCreateStatusItem(descriptor.alignment, descriptor.priority);
......@@ -200,12 +203,6 @@ export class StatusbarPart extends Part implements IStatusbarService {
return dispose;
}
public dispose(): void {
this.toDispose = dispose(this.toDispose);
super.dispose();
}
}
let manageExtensionAction: ManageExtensionAction;
......
......@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!vs/workbench/parts/debug/browser/media/debugActionsWidget';
import * as lifecycle from 'vs/base/common/lifecycle';
import * as errors from 'vs/base/common/errors';
import * as strings from 'vs/base/common/strings';
import * as browser from 'vs/base/browser/browser';
......@@ -45,7 +44,6 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
private $el: builder.Builder;
private dragArea: builder.Builder;
private toDispose: lifecycle.IDisposable[];
private actionBar: ActionBar;
private allActions: AbstractDebugAction[];
private activeActions: AbstractDebugAction[];
......@@ -72,7 +70,6 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
const actionBarContainter = $().div().addClass('.action-bar-container');
this.$el.append(actionBarContainter);
this.toDispose = [];
this.activeActions = [];
this.actionBar = new ActionBar(actionBarContainter, {
orientation: ActionsOrientation.HORIZONTAL,
......@@ -87,7 +84,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.updateStyles();
this.toDispose.push(this.actionBar);
this.toUnbind.push(this.actionBar);
this.registerListeners();
this.hide();
......@@ -95,9 +92,9 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
}
private registerListeners(): void {
this.toDispose.push(this.debugService.onDidChangeState(state => this.update(state)));
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(() => this.update(this.debugService.state)));
this.toDispose.push(this.actionBar.actionRunner.addListener(EventType.RUN, (e: any) => {
this.toUnbind.push(this.debugService.onDidChangeState(state => this.update(state)));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(() => this.update(this.debugService.state)));
this.toUnbind.push(this.actionBar.actionRunner.addListener(EventType.RUN, (e: any) => {
// check for error
if (e.error && !errors.isPromiseCanceledError(e.error)) {
this.messageService.show(severity.Error, e.error);
......@@ -108,7 +105,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.telemetryService.publicLog('workbenchActionExecuted', { id: e.action.id, from: 'debugActionsWidget' });
}
}));
$(window).on(dom.EventType.RESIZE, () => this.setXCoordinate(), this.toDispose);
$(window).on(dom.EventType.RESIZE, () => this.setXCoordinate(), this.toUnbind);
this.dragArea.on(dom.EventType.MOUSE_UP, (event: MouseEvent) => {
const mouseClickEvent = new StandardMouseEvent(event);
......@@ -137,8 +134,8 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
});
});
this.toDispose.push(this.partService.onTitleBarVisibilityChange(() => this.positionDebugWidget()));
this.toDispose.push(browser.onDidChangeZoomLevel(() => this.positionDebugWidget()));
this.toUnbind.push(this.partService.onTitleBarVisibilityChange(() => this.positionDebugWidget()));
this.toUnbind.push(browser.onDidChangeZoomLevel(() => this.positionDebugWidget()));
}
private storePosition(): void {
......@@ -235,7 +232,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.allActions.push(this.instantiationService.createInstance(ReverseContinueAction, ReverseContinueAction.ID, ReverseContinueAction.LABEL));
this.allActions.push(this.instantiationService.createInstance(FocusProcessAction, FocusProcessAction.ID, FocusProcessAction.LABEL));
this.allActions.forEach(a => {
this.toDispose.push(a);
this.toUnbind.push(a);
});
}
......@@ -271,7 +268,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
}
public dispose(): void {
this.toDispose = lifecycle.dispose(this.toDispose);
super.dispose();
if (this.$el) {
this.$el.destroy();
......
......@@ -9,7 +9,6 @@ import uri from 'vs/base/common/uri';
import { wireCancellationToken } from 'vs/base/common/async';
import { TPromise } from 'vs/base/common/winjs.base';
import * as errors from 'vs/base/common/errors';
import * as lifecycle from 'vs/base/common/lifecycle';
import { IAction } from 'vs/base/common/actions';
import { Dimension, Builder } from 'vs/base/browser/builder';
import * as dom from 'vs/base/browser/dom';
......@@ -73,7 +72,6 @@ export class Repl extends Panel implements IPrivateReplService {
private static REPL_INPUT_INITIAL_HEIGHT = 19;
private static REPL_INPUT_MAX_HEIGHT = 170;
private toDispose: lifecycle.IDisposable[];
private tree: ITree;
private renderer: ReplExpressionsRenderer;
private characterWidthSurveyor: HTMLElement;
......@@ -99,15 +97,14 @@ export class Repl extends Panel implements IPrivateReplService {
super(debug.REPL_ID, telemetryService, themeService);
this.replInputHeight = Repl.REPL_INPUT_INITIAL_HEIGHT;
this.toDispose = [];
this.registerListeners();
}
private registerListeners(): void {
this.toDispose.push(this.debugService.getModel().onDidChangeReplElements(() => {
this.toUnbind.push(this.debugService.getModel().onDidChangeReplElements(() => {
this.refreshReplElements(this.debugService.getModel().getReplElements().length === 0);
}));
this.toDispose.push(this.panelService.onDidPanelOpen(panel => this.refreshReplElements(true)));
this.toUnbind.push(this.panelService.onDidPanelOpen(panel => this.refreshReplElements(true)));
}
private refreshReplElements(noDelay: boolean): void {
......@@ -154,8 +151,8 @@ export class Repl extends Panel implements IPrivateReplService {
controller
}, replTreeOptions);
this.toDispose.push(attachListStyler(this.tree, this.themeService));
this.toDispose.push(this.listService.register(this.tree));
this.toUnbind.push(attachListStyler(this.tree, this.themeService));
this.toUnbind.push(this.listService.register(this.tree));
if (!Repl.HISTORY) {
Repl.HISTORY = new ReplHistory(JSON.parse(this.storageService.get(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE, '[]')));
......@@ -168,7 +165,7 @@ export class Repl extends Panel implements IPrivateReplService {
this.replInputContainer = dom.append(container, $('.repl-input-wrapper'));
const scopedContextKeyService = this.contextKeyService.createScoped(this.replInputContainer);
this.toDispose.push(scopedContextKeyService);
this.toUnbind.push(scopedContextKeyService);
debug.CONTEXT_IN_DEBUG_REPL.bindTo(scopedContextKeyService).set(true);
const onFirstReplLine = debug.CONTEXT_ON_FIRST_DEBUG_REPL_LINE.bindTo(scopedContextKeyService);
onFirstReplLine.set(true);
......@@ -197,20 +194,20 @@ export class Repl extends Panel implements IPrivateReplService {
}
});
this.toDispose.push(this.replInput.onDidScrollChange(e => {
this.toUnbind.push(this.replInput.onDidScrollChange(e => {
if (!e.scrollHeightChanged) {
return;
}
this.replInputHeight = Math.max(Repl.REPL_INPUT_INITIAL_HEIGHT, Math.min(Repl.REPL_INPUT_MAX_HEIGHT, e.scrollHeight, this.dimension.height));
this.layout(this.dimension);
}));
this.toDispose.push(this.replInput.onDidChangeCursorPosition(e => {
this.toUnbind.push(this.replInput.onDidChangeCursorPosition(e => {
onFirstReplLine.set(e.position.lineNumber === 1);
onLastReplLine.set(e.position.lineNumber === this.replInput.getModel().getLineCount());
}));
this.toDispose.push(dom.addStandardDisposableListener(this.replInputContainer, dom.EventType.FOCUS, () => dom.addClass(this.replInputContainer, 'synthetic-focus')));
this.toDispose.push(dom.addStandardDisposableListener(this.replInputContainer, dom.EventType.BLUR, () => dom.removeClass(this.replInputContainer, 'synthetic-focus')));
this.toUnbind.push(dom.addStandardDisposableListener(this.replInputContainer, dom.EventType.FOCUS, () => dom.addClass(this.replInputContainer, 'synthetic-focus')));
this.toUnbind.push(dom.addStandardDisposableListener(this.replInputContainer, dom.EventType.BLUR, () => dom.removeClass(this.replInputContainer, 'synthetic-focus')));
}
public navigateHistory(previous: boolean): void {
......@@ -270,7 +267,7 @@ export class Repl extends Panel implements IPrivateReplService {
];
this.actions.forEach(a => {
this.toDispose.push(a);
this.toUnbind.push(a);
});
}
......@@ -311,7 +308,6 @@ export class Repl extends Panel implements IPrivateReplService {
public dispose(): void {
this.replInput.dispose();
this.toDispose = lifecycle.dispose(this.toDispose);
super.dispose();
}
}
......
......@@ -48,11 +48,8 @@ export class StatusBarColorProvider extends Themable implements IWorkbenchContri
}
private registerListeners(): void {
this.toUnbind.push(this.debugService.onDidChangeState(state => this.onDidChangeState(state)));
}
private onDidChangeState(state: State): void {
this.updateStyles();
this.toUnbind.push(this.debugService.onDidChangeState(state => this.updateStyles()));
this.toUnbind.push(this.contextService.onDidChangeWorkspaceRoots(state => this.updateStyles()));
}
protected updateStyles(): void {
......
......@@ -58,6 +58,12 @@ export class FeedbackStatusbarItem extends Themable implements IStatusbarItem {
@IThemeService themeService: IThemeService
) {
super(themeService);
this.registerListeners();
}
private registerListeners(): void {
this.toUnbind.push(this.contextService.onDidChangeWorkspaceRoots(() => this.updateStyles()));
}
protected updateStyles(): void {
......
......@@ -10,7 +10,6 @@ import URI from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { Delayer } from 'vs/base/common/async';
import dom = require('vs/base/browser/dom');
import lifecycle = require('vs/base/common/lifecycle');
import builder = require('vs/base/browser/builder');
import { IAction, Action } from 'vs/base/common/actions';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
......@@ -44,7 +43,6 @@ export class MarkersPanel extends Panel {
public markersModel: MarkersModel;
private toDispose: lifecycle.IDisposable[];
private delayedRefresh: Delayer<void>;
private lastSelectedRelativeTop: number = 0;
......@@ -78,7 +76,6 @@ export class MarkersPanel extends Panel {
@IThemeService themeService: IThemeService
) {
super(Constants.MARKERS_PANEL_ID, telemetryService, themeService);
this.toDispose = [];
this.delayedRefresh = new Delayer<void>(500);
this.autoExpanded = new Set<string>();
this.markerFocusContextKey = Constants.MarkerFocusContextKey.bindTo(contextKeyService);
......@@ -89,7 +86,7 @@ export class MarkersPanel extends Panel {
this.markersModel = new MarkersModel();
this.rangeHighlightDecorations = this.instantiationService.createInstance(RangeHighlightDecorations);
this.toDispose.push(this.rangeHighlightDecorations);
this.toUnbind.push(this.rangeHighlightDecorations);
dom.addClass(parent.getHTMLElement(), 'markers-panel');
......@@ -233,7 +230,7 @@ export class MarkersPanel extends Panel {
this.markerFocusContextKey.set(false);
});
this.toDispose.push(this.listService.register(this.tree));
this.toUnbind.push(this.listService.register(this.tree));
}
private createActions(): void {
......@@ -244,15 +241,15 @@ export class MarkersPanel extends Panel {
this.collapseAllAction
];
this.actions.forEach(a => {
this.toDispose.push(a);
this.toUnbind.push(a);
});
}
private createListeners(): void {
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationsUpdated(this.configurationService.getConfiguration<IProblemsConfiguration>())));
this.toDispose.push(this.markerService.onMarkerChanged(this.onMarkerChanged, this));
this.toDispose.push(this.editorGroupService.onEditorsChanged(this.onEditorsChanged, this));
this.toDispose.push(this.tree.addListener('selection', () => this.onSelected()));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationsUpdated(this.configurationService.getConfiguration<IProblemsConfiguration>())));
this.toUnbind.push(this.markerService.onMarkerChanged(this.onMarkerChanged, this));
this.toUnbind.push(this.editorGroupService.onEditorsChanged(this.onEditorsChanged, this));
this.toUnbind.push(this.tree.addListener('selection', () => this.onSelected()));
}
private onMarkerChanged(changedResources: URI[]) {
......@@ -409,10 +406,10 @@ export class MarkersPanel extends Panel {
}
public dispose(): void {
super.dispose();
this.delayedRefresh.cancel();
this.toDispose = lifecycle.dispose(this.toDispose);
this.tree.dispose();
this.markersModel.dispose();
super.dispose();
}
}
\ No newline at end of file
......@@ -5,7 +5,6 @@
import 'vs/css!./media/output';
import nls = require('vs/nls');
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action, IAction } from 'vs/base/common/actions';
import { Builder } from 'vs/base/browser/builder';
......@@ -27,7 +26,6 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
export class OutputPanel extends TextResourceEditor {
private toDispose: IDisposable[];
private actions: IAction[];
private scopedInstantiationService: IInstantiationService;
......@@ -46,7 +44,6 @@ export class OutputPanel extends TextResourceEditor {
super(telemetryService, instantiationService, storageService, configurationService, themeService, editorGroupService, modeService, textFileService);
this.scopedInstantiationService = instantiationService;
this.toDispose = [];
}
public getId(): string {
......@@ -62,7 +59,7 @@ export class OutputPanel extends TextResourceEditor {
];
this.actions.forEach(a => {
this.toDispose.push(a);
this.toUnbind.push(a);
});
}
......@@ -111,7 +108,7 @@ export class OutputPanel extends TextResourceEditor {
// First create the scoped instantation service and only then construct the editor using the scoped service
const scopedContextKeyService = this.contextKeyService.createScoped(parent.getHTMLElement());
this.toDispose.push(scopedContextKeyService);
this.toUnbind.push(scopedContextKeyService);
this.scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection([IContextKeyService, scopedContextKeyService]));
super.createEditor(parent);
......@@ -122,10 +119,4 @@ export class OutputPanel extends TextResourceEditor {
public get instantiationService(): IInstantiationService {
return this.scopedInstantiationService;
}
public dispose(): void {
this.toDispose = dispose(this.toDispose);
super.dispose();
}
}
......@@ -69,7 +69,6 @@ export class SearchViewlet extends Viewlet {
private static SHOW_REPLACE_STORAGE_KEY = 'vs.search.show.replace';
private isDisposed: boolean;
private toDispose: lifecycle.IDisposable[];
private loading: boolean;
private queryBuilder: QueryBuilder;
......@@ -126,7 +125,6 @@ export class SearchViewlet extends Viewlet {
) {
super(Constants.VIEWLET_ID, telemetryService, themeService);
this.toDispose = [];
this.viewletVisible = Constants.SearchViewletVisibleKey.bindTo(contextKeyService);
this.inputBoxFocused = Constants.InputBoxFocusedKey.bindTo(this.contextKeyService);
this.inputPatternIncludesFocused = Constants.PatternIncludesFocusedKey.bindTo(this.contextKeyService);
......@@ -483,7 +481,7 @@ export class SearchViewlet extends Viewlet {
keyboardSupport: false
});
this.toDispose.push(attachListStyler(this.tree, this.themeService));
this.toUnbind.push(attachListStyler(this.tree, this.themeService));
this.tree.setInput(this.viewModel.searchResult);
this.toUnbind.push(renderer);
......@@ -1427,8 +1425,6 @@ export class SearchViewlet extends Viewlet {
public dispose(): void {
this.isDisposed = true;
this.toDispose = lifecycle.dispose(this.toDispose);
if (this.tree) {
this.tree.dispose();
}
......
......@@ -283,6 +283,12 @@ class BuildStatusBarItem extends Themable implements IStatusbarItem {
this.activeCount = 0;
this.icons = [];
this.registerListeners();
}
private registerListeners(): void {
this.toUnbind.push(this.contextService.onDidChangeWorkspaceRoots(() => this.updateStyles()));
}
protected updateStyles(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册