Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoao Moreno <jomo@microsoft.com>2017-11-16 20:22:35 +0300
committerJoao Moreno <jomo@microsoft.com>2017-11-16 20:25:17 +0300
commit6c3c74ab21e463ffc8804d481490df71028beb09 (patch)
tree6332da0c243ff8bb6b91f731405b85ef1df8c338 /src/vs/workbench
parentb6db56277d80e1453462313b3a161a420ee6cb65 (diff)
remove usages of EventEmitter from tree
related to #38417
Diffstat (limited to 'src/vs/workbench')
-rw-r--r--src/vs/workbench/browser/parts/views/treeView.ts2
-rw-r--r--src/vs/workbench/parts/debug/electron-browser/debugHover.ts4
-rw-r--r--src/vs/workbench/parts/debug/electron-browser/debugViewer.ts4
-rw-r--r--src/vs/workbench/parts/debug/electron-browser/debugViews.ts12
-rw-r--r--src/vs/workbench/parts/extensions/browser/extensionEditor.ts2
-rw-r--r--src/vs/workbench/parts/files/browser/fileActions.ts5
-rw-r--r--src/vs/workbench/parts/files/browser/fileResultsNavigation.ts4
-rw-r--r--src/vs/workbench/parts/files/browser/views/explorerView.ts4
-rw-r--r--src/vs/workbench/parts/files/browser/views/openEditorsView.ts4
-rw-r--r--src/vs/workbench/parts/markers/browser/markersPanel.ts4
-rw-r--r--src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts4
-rw-r--r--src/vs/workbench/parts/search/browser/searchViewlet.ts4
12 files changed, 26 insertions, 27 deletions
diff --git a/src/vs/workbench/browser/parts/views/treeView.ts b/src/vs/workbench/browser/parts/views/treeView.ts
index ba88ed44156..30d2e6856e2 100644
--- a/src/vs/workbench/browser/parts/views/treeView.ts
+++ b/src/vs/workbench/browser/parts/views/treeView.ts
@@ -100,7 +100,7 @@ export class TreeView extends ViewsViewletPanel {
this.disposables.push(attachListStyler(tree, this.themeService));
this.disposables.push(this.listService.register(tree, [this.viewFocusContext]));
- tree.addListener('selection', (event: any) => this.onSelection());
+ this.disposables.push(tree.onDidChangeSelection(() => this.onSelection()));
return tree;
}
diff --git a/src/vs/workbench/parts/debug/electron-browser/debugHover.ts b/src/vs/workbench/parts/debug/electron-browser/debugHover.ts
index 9dec498f49a..3dd805e96a0 100644
--- a/src/vs/workbench/parts/debug/electron-browser/debugHover.ts
+++ b/src/vs/workbench/parts/debug/electron-browser/debugHover.ts
@@ -105,10 +105,10 @@ export class DebugHoverWidget implements IContentWidget {
}
private registerListeners(): void {
- this.toDispose.push(this.tree.addListener('item:expanded', () => {
+ this.toDispose.push(this.tree.onDidExpandItem(() => {
this.layoutTree();
}));
- this.toDispose.push(this.tree.addListener('item:collapsed', () => {
+ this.toDispose.push(this.tree.onDidCollapseItem(() => {
this.layoutTree();
}));
diff --git a/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts b/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts
index e3e0580f11a..6ceb6e94793 100644
--- a/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts
+++ b/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts
@@ -299,7 +299,7 @@ export class CallStackController extends BaseDebugController {
return true;
}
- public focusStackFrame(stackFrame: debug.IStackFrame, event: IKeyboardEvent | IMouseEvent, preserveFocus: boolean): void {
+ public focusStackFrame(stackFrame: debug.IStackFrame, event: any, preserveFocus: boolean): void {
this.debugService.focusStackFrameAndEvaluate(stackFrame, undefined, true).then(() => {
const sideBySide = (event && (event.ctrlKey || event.metaKey));
return stackFrame.openInEditor(this.editorService, preserveFocus, sideBySide);
@@ -1290,7 +1290,7 @@ export class BreakpointsController extends BaseDebugController {
return super.onLeftClick(tree, element, event);
}
- public openBreakpointSource(breakpoint: Breakpoint, event: IKeyboardEvent | IMouseEvent, preserveFocus: boolean): void {
+ public openBreakpointSource(breakpoint: Breakpoint, event: any, preserveFocus: boolean): void {
if (breakpoint.uri.scheme === debug.DEBUG_SCHEME && this.debugService.state === debug.State.Inactive) {
return;
}
diff --git a/src/vs/workbench/parts/debug/electron-browser/debugViews.ts b/src/vs/workbench/parts/debug/electron-browser/debugViews.ts
index 77c31005f1c..b2324b2b712 100644
--- a/src/vs/workbench/parts/debug/electron-browser/debugViews.ts
+++ b/src/vs/workbench/parts/debug/electron-browser/debugViews.ts
@@ -10,7 +10,6 @@ import * as dom from 'vs/base/browser/dom';
import * as builder from 'vs/base/browser/builder';
import { TPromise } from 'vs/base/common/winjs.base';
import * as errors from 'vs/base/common/errors';
-import { EventType } from 'vs/base/common/events';
import { IAction } from 'vs/base/common/actions';
import { prepareActions } from 'vs/workbench/browser/actions';
import { IHighlightEvent, ITree } from 'vs/base/parts/tree/browser/tree';
@@ -29,6 +28,7 @@ import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/c
import { IListService } from 'vs/platform/list/browser/listService';
import { attachListStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
+import { once } from 'vs/base/common/event';
function renderViewTree(container: HTMLElement): HTMLElement {
const treeContainer = document.createElement('div');
@@ -136,7 +136,7 @@ export class VariablesView extends ViewsViewletPanel {
this.tree.refresh(expression, false).then(() => {
this.tree.setHighlight(expression);
- this.tree.addOneTimeListener(EventType.HIGHLIGHT, (e: IHighlightEvent) => {
+ once(this.tree.onDidChangeHighlight)((e: IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
}
@@ -228,7 +228,7 @@ export class WatchExpressionsView extends ViewsViewletPanel {
this.tree.refresh(expression, false).then(() => {
this.tree.setHighlight(expression);
- this.tree.addOneTimeListener(EventType.HIGHLIGHT, (e: IHighlightEvent) => {
+ once(this.tree.onDidChangeHighlight)((e: IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
}
@@ -319,7 +319,7 @@ export class CallStackView extends ViewsViewletPanel {
this.disposables.push(attachListStyler(this.tree, this.themeService));
this.disposables.push(this.listService.register(this.tree));
- this.disposables.push(this.tree.addListener('selection', event => {
+ this.disposables.push(this.tree.onDidChangeSelection(event => {
if (event && event.payload && event.payload.origin === 'keyboard') {
const element = this.tree.getFocus();
if (element instanceof ThreadAndProcessIds) {
@@ -454,7 +454,7 @@ export class BreakpointsView extends ViewsViewletPanel {
this.disposables.push(attachListStyler(this.tree, this.themeService));
this.disposables.push(this.listService.register(this.tree, [this.breakpointsFocusedContext]));
- this.disposables.push(this.tree.addListener('selection', event => {
+ this.disposables.push(this.tree.onDidChangeSelection(event => {
if (event && event.payload && event.payload.origin === 'keyboard') {
const element = this.tree.getFocus();
if (element instanceof Breakpoint) {
@@ -474,7 +474,7 @@ export class BreakpointsView extends ViewsViewletPanel {
this.tree.refresh(fbp, false).then(() => {
this.tree.setHighlight(fbp);
- this.tree.addOneTimeListener(EventType.HIGHLIGHT, (e: IHighlightEvent) => {
+ once(this.tree.onDidChangeHighlight)((e: IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedFunctionBreakpoint(null);
}
diff --git a/src/vs/workbench/parts/extensions/browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/browser/extensionEditor.ts
index 5489c928ecf..d2102082d06 100644
--- a/src/vs/workbench/parts/extensions/browser/extensionEditor.ts
+++ b/src/vs/workbench/parts/extensions/browser/extensionEditor.ts
@@ -532,7 +532,7 @@ export class ExtensionEditor extends BaseEditor {
tree.setInput(extensionDependencies);
- this.contentDisposables.push(tree.addListener('selection', event => {
+ this.contentDisposables.push(tree.onDidChangeSelection(event => {
if (event && event.payload && event.payload.origin === 'keyboard') {
controller.openExtension(tree, false);
}
diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts
index 864e141fa9c..fdb24e9ea11 100644
--- a/src/vs/workbench/parts/files/browser/fileActions.ts
+++ b/src/vs/workbench/parts/files/browser/fileActions.ts
@@ -16,7 +16,6 @@ import URI from 'vs/base/common/uri';
import errors = require('vs/base/common/errors');
import { toErrorMessage } from 'vs/base/common/errorMessage';
import strings = require('vs/base/common/strings');
-import { EventType as CommonEventType } from 'vs/base/common/events';
import severity from 'vs/base/common/severity';
import diagnostics = require('vs/base/common/diagnostics');
import { Action, IAction } from 'vs/base/common/actions';
@@ -209,7 +208,7 @@ export class TriggerRenameFileAction extends BaseFileAction {
this.tree.refresh(stat, false).then(() => {
this.tree.setHighlight(stat);
- const unbind = this.tree.addListener(CommonEventType.HIGHLIGHT, (e: IHighlightEvent) => {
+ const unbind = this.tree.onDidChangeHighlight((e: IHighlightEvent) => {
if (!e.highlight) {
viewletState.clearEditable(stat);
this.tree.refresh(stat).done(null, errors.onUnexpectedError);
@@ -422,7 +421,7 @@ export class BaseNewAction extends BaseFileAction {
return this.tree.reveal(stat, 0.5).then(() => {
this.tree.setHighlight(stat);
- const unbind = this.tree.addListener(CommonEventType.HIGHLIGHT, (e: IHighlightEvent) => {
+ const unbind = this.tree.onDidChangeHighlight((e: IHighlightEvent) => {
if (!e.highlight) {
stat.destroy();
this.tree.refresh(folder).done(null, errors.onUnexpectedError);
diff --git a/src/vs/workbench/parts/files/browser/fileResultsNavigation.ts b/src/vs/workbench/parts/files/browser/fileResultsNavigation.ts
index 9174477d966..79f3a7ca198 100644
--- a/src/vs/workbench/parts/files/browser/fileResultsNavigation.ts
+++ b/src/vs/workbench/parts/files/browser/fileResultsNavigation.ts
@@ -22,8 +22,8 @@ export default class FileResultsNavigation extends Disposable {
constructor(private tree: ITree) {
super();
- this._register(this.tree.addListener('focus', e => this.onFocus(e)));
- this._register(this.tree.addListener('selection', e => this.onSelection(e)));
+ this._register(this.tree.onDidChangeFocus(e => this.onFocus(e)));
+ this._register(this.tree.onDidChangeSelection(e => this.onSelection(e)));
}
private onFocus(event: any): void {
diff --git a/src/vs/workbench/parts/files/browser/views/explorerView.ts b/src/vs/workbench/parts/files/browser/views/explorerView.ts
index aa58908d1e4..8c0bb21d272 100644
--- a/src/vs/workbench/parts/files/browser/views/explorerView.ts
+++ b/src/vs/workbench/parts/files/browser/views/explorerView.ts
@@ -443,13 +443,13 @@ export class ExplorerView extends ViewsViewletPanel {
this.disposables.push(this.fileService.onFileChanges(e => this.onFileChanges(e)));
// Update resource context based on focused element
- this.disposables.push(this.explorerViewer.addListener('focus', (e: { focus: FileStat }) => {
+ this.disposables.push(this.explorerViewer.onDidChangeFocus((e: { focus: FileStat }) => {
this.resourceContext.set(e.focus && e.focus.resource);
this.folderContext.set(e.focus && e.focus.isDirectory);
}));
// Open when selecting via keyboard
- this.disposables.push(this.explorerViewer.addListener('selection', event => {
+ this.disposables.push(this.explorerViewer.onDidChangeSelection(event => {
if (event && event.payload && event.payload.origin === 'keyboard') {
const element = this.tree.getSelection();
diff --git a/src/vs/workbench/parts/files/browser/views/openEditorsView.ts b/src/vs/workbench/parts/files/browser/views/openEditorsView.ts
index e248d36c195..6467e58b843 100644
--- a/src/vs/workbench/parts/files/browser/views/openEditorsView.ts
+++ b/src/vs/workbench/parts/files/browser/views/openEditorsView.ts
@@ -145,14 +145,14 @@ export class OpenEditorsView extends ViewsViewletPanel {
this.disposables.push(this.listService.register(this.tree, [this.explorerFocusedContext, this.openEditorsFocusedContext]));
// Open when selecting via keyboard
- this.disposables.push(this.tree.addListener('selection', event => {
+ this.disposables.push(this.tree.onDidChangeSelection(event => {
if (event && event.payload && event.payload.origin === 'keyboard') {
controller.openEditor(this.tree.getFocus(), { pinned: false, sideBySide: false, preserveFocus: false });
}
}));
// Prevent collapsing of editor groups
- this.disposables.push(this.tree.addListener('item:collapsed', (event: IItemCollapseEvent) => {
+ this.disposables.push(this.tree.onDidCollapseItem((event: IItemCollapseEvent) => {
if (event.item && event.item.getElement() instanceof EditorGroup) {
setTimeout(() => this.tree.expand(event.item.getElement())); // unwind from callback
}
diff --git a/src/vs/workbench/parts/markers/browser/markersPanel.ts b/src/vs/workbench/parts/markers/browser/markersPanel.ts
index 7896ae60685..17d1e7cc94f 100644
--- a/src/vs/workbench/parts/markers/browser/markersPanel.ts
+++ b/src/vs/workbench/parts/markers/browser/markersPanel.ts
@@ -217,7 +217,7 @@ export class MarkersPanel extends Panel {
this._register(attachListStyler(this.tree, this.themeService));
- this._register(this.tree.addListener('focus', (e: { focus: any }) => {
+ this._register(this.tree.onDidChangeFocus((e: { focus: any }) => {
this.markerFocusContextKey.set(e.focus instanceof Marker);
}));
@@ -249,7 +249,7 @@ export class MarkersPanel extends Panel {
private createListeners(): void {
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()));
+ this.toUnbind.push(this.tree.onDidChangeSelection(() => this.onSelected()));
}
private onMarkerChanged(changedResources: URI[]) {
diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
index 18e5249494b..d05141ecc03 100644
--- a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
+++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
@@ -332,10 +332,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
{ identityProvider: e => e.id, keyboardSupport: false, mouseSupport: true, ariaLabel: localize('keybindingsLabel', "Keybindings") }));
this._register(this.keybindingsList.onContextMenu(e => this.onContextMenu(e)));
this._register(this.keybindingsList.onFocusChange(e => this.onFocusChange(e)));
- this._register(this.keybindingsList.onDOMFocus(() => {
+ this._register(this.keybindingsList.onDidFocus(() => {
DOM.addClass(this.keybindingsList.getHTMLElement(), 'focused');
}));
- this._register(this.keybindingsList.onDOMBlur(() => {
+ this._register(this.keybindingsList.onDidBlur(() => {
DOM.removeClass(this.keybindingsList.getHTMLElement(), 'focused');
this.keybindingFocusContextKey.reset();
}));
diff --git a/src/vs/workbench/parts/search/browser/searchViewlet.ts b/src/vs/workbench/parts/search/browser/searchViewlet.ts
index 48fd64b555f..05c2a2c4389 100644
--- a/src/vs/workbench/parts/search/browser/searchViewlet.ts
+++ b/src/vs/workbench/parts/search/browser/searchViewlet.ts
@@ -524,7 +524,7 @@ export class SearchViewlet extends Viewlet {
}
}));
- this.toUnbind.push(this.tree.addListener('focus', (e: IFocusEvent) => {
+ this.toUnbind.push(this.tree.onDidChangeFocus((e: IFocusEvent) => {
const focus = e.focus;
this.firstMatchFocused.set(this.tree.getNavigator().first() === focus);
this.fileMatchOrMatchFocused.set(true);
@@ -533,7 +533,7 @@ export class SearchViewlet extends Viewlet {
this.matchFocused.set(focus instanceof Match);
}));
- this.toUnbind.push(this.tree.onDOMBlur(e => {
+ this.toUnbind.push(this.tree.onDidBlur(e => {
this.firstMatchFocused.reset();
this.fileMatchOrMatchFocused.reset();
this.fileMatchFocused.reset();