ContentProvider -> TreeExplorerNodeProvider

This commit is contained in:
Pine Wu
2016-10-19 10:09:19 -07:00
parent 0c189793a3
commit 045aeddd15
6 changed files with 20 additions and 26 deletions

View File

@@ -335,7 +335,7 @@ export function createApiFactory(threadService: IThreadService, extensionService
return extHostDocumentSaveParticipant.onWillSaveTextDocumentEvent(listener, thisArgs, disposables);
},
registerTreeExplorerNodeProvider(providerId: string, provider: vscode.TreeExplorerNodeProvider<any>) {
return extHostExplorers.registerTreeContentProvider(providerId, provider);
return extHostExplorers.registerTreeExplorerNodeProvider(providerId, provider);
},
onDidChangeConfiguration: (listener: () => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) => {
return extHostConfiguration.onDidChangeConfiguration(listener, thisArgs, disposables);

View File

@@ -118,8 +118,8 @@ export abstract class MainThreadEditorsShape {
}
export abstract class MainThreadTreeExplorersShape {
$registerTreeContentProvider(treeContentProviderId: string): void { throw ni(); }
$unregisterTreeContentProvider(treeContentProviderId: string): void { throw ni(); }
$registerTreeExplorerNodeProvider(providerId: string): void { throw ni(); }
$unregisterTreeExplorerNodeProvider(providerId: string): void { throw ni(); }
}
export abstract class MainThreadErrorsShape {
@@ -365,7 +365,7 @@ export const ExtHostContext = {
ExtHostDocuments: createExtId<ExtHostDocumentsShape>('ExtHostDocuments', ExtHostDocumentsShape),
ExtHostDocumentSaveParticipant: createExtId<ExtHostDocumentSaveParticipantShape>('ExtHostDocumentSaveParticipant', ExtHostDocumentSaveParticipantShape),
ExtHostEditors: createExtId<ExtHostEditorsShape>('ExtHostEditors', ExtHostEditorsShape),
ExtHostExplorers: createExtId<ExtHostTreeExplorersShape>('ExtHostExplorers',ExtHostTreeExplorersShape),
ExtHostExplorers: createExtId<ExtHostTreeExplorersShape>('ExtHostExplorers', ExtHostTreeExplorersShape),
ExtHostFileSystemEventService: createExtId<ExtHostFileSystemEventServiceShape>('ExtHostFileSystemEventService', ExtHostFileSystemEventServiceShape),
ExtHostHeapService: createExtId<ExtHostHeapServiceShape>('ExtHostHeapMonitor', ExtHostHeapServiceShape),
ExtHostLanguageFeatures: createExtId<ExtHostLanguageFeaturesShape>('ExtHostLanguageFeatures', ExtHostLanguageFeaturesShape),

View File

@@ -31,13 +31,13 @@ export class ExtHostTreeExplorers extends ExtHostTreeExplorersShape {
this._externalNodeMaps = Object.create(null);
}
registerTreeContentProvider(providerId: string, provider: TreeExplorerNodeProvider<any>): Disposable {
this._proxy.$registerTreeContentProvider(providerId);
registerTreeExplorerNodeProvider(providerId: string, provider: TreeExplorerNodeProvider<any>): Disposable {
this._proxy.$registerTreeExplorerNodeProvider(providerId);
this._treeExplorerNodeProviders[providerId] = provider;
return new Disposable(() => {
if (delete this._treeExplorerNodeProviders[providerId]) {
this._proxy.$unregisterTreeContentProvider(providerId);
this._proxy.$unregisterTreeExplorerNodeProvider(providerId);
}
});
}

View File

@@ -13,8 +13,6 @@ import { InternalTreeExplorerNode } from 'vs/workbench/parts/explorers/common/tr
export class MainThreadTreeExplorers extends MainThreadTreeExplorersShape {
private _proxy: ExtHostTreeExplorersShape;
private _treeContents: { [treeContentProviderId: string]: InternalTreeExplorerNode };
constructor(
@IThreadService threadService: IThreadService,
@ITreeExplorerViewletService private treeExplorerService: ITreeExplorerViewletService
@@ -22,16 +20,12 @@ export class MainThreadTreeExplorers extends MainThreadTreeExplorersShape {
super();
this._proxy = threadService.get(ExtHostContext.ExtHostExplorers);
this._treeContents = Object.create(null);
}
$registerTreeContentProvider(providerId: string): void {
this.treeExplorerService.registerTreeContentProvider(providerId, {
$registerTreeExplorerNodeProvider(providerId: string): void {
this.treeExplorerService.registerTreeExplorerNodeProvider(providerId, {
provideRootNode: (): TPromise<InternalTreeExplorerNode> => {
return this._proxy.$provideRootNode(providerId).then(treeContent => {
this._treeContents[providerId] = treeContent;
return treeContent;
});
return this._proxy.$provideRootNode(providerId);
},
resolveChildren: (node: InternalTreeExplorerNode): TPromise<InternalTreeExplorerNode[]> => {
return this._proxy.$resolveChildren(providerId, node);
@@ -42,7 +36,7 @@ export class MainThreadTreeExplorers extends MainThreadTreeExplorersShape {
});
}
$unregisterTreeContentProvider(treeContentProviderId: string): void {
$unregisterTreeExplorerNodeProvider(providerId: string): void {
}
}