Hook up provider mechanism and add onClick

This commit is contained in:
Pine Wu
2016-09-30 16:38:56 -07:00
parent d03ea815b6
commit d8c0af7f6d
11 changed files with 112 additions and 69 deletions

View File

@@ -1,19 +1,35 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ITreeNode } from 'vscode';
import {TPromise} from 'vs/base/common/winjs.base';
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
import {ExtHostContext, MainThreadExplorersShape, ExtHostExplorersShape} from './extHost.protocol';
import {ITreeExplorerViewletService} from 'vs/workbench/parts/explorers/browser/treeExplorerViewletService';
export class MainThreadExplorers extends MainThreadExplorersShape {
private _proxy: ExtHostExplorersShape;
constructor(
@IThreadService threadService: IThreadService
@IThreadService threadService: IThreadService,
@ITreeExplorerViewletService private treeExplorerViewletService: ITreeExplorerViewletService
) {
super();
this._proxy = threadService.get(ExtHostContext.ExtHostExplorers);
}
$registerTreeContentProvider(treeContentProviderId: string): void {
const tree = this._proxy.$provideTextDocumentContent(treeContentProviderId);
$registerTreeContentProvider(providerId: string): void {
this.treeExplorerViewletService.registerTreeContentProvider(providerId, {
provideTreeContent: (): TPromise<ITreeNode> => {
return this._proxy.$provideTreeContent(providerId).then(jsonTree => {
return <ITreeNode>JSON.parse(jsonTree);
})
}
});
}
$unregisterTreeContentProvider(treeContentProviderId: string): void {