Resolving onClickCommand and clean up

Drop the viewlet part in treeExplorerViewletService
This commit is contained in:
Pine Wu
2016-10-11 15:24:34 -07:00
parent 09703d267e
commit c7f2d3d1f1
10 changed files with 53 additions and 22 deletions

View File

@@ -10,6 +10,7 @@ import { Disposable } from 'vs/workbench/api/node/extHostTypes';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, ExtHostTreeExplorersShape, MainThreadTreeExplorersShape } from './extHost.protocol';
import { InternalTreeExplorerNode } from 'vs/workbench/parts/explorers/common/treeExplorerViewModel';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
export class ExtHostTreeExplorers extends ExtHostTreeExplorersShape {
private _proxy: MainThreadTreeExplorersShape;
@@ -19,7 +20,8 @@ export class ExtHostTreeExplorers extends ExtHostTreeExplorersShape {
private _externalNodeMaps: { [providerId: string]: { [id: number]: TreeExplorerNode }};
constructor(
threadService: IThreadService
threadService: IThreadService,
private commands: ExtHostCommands
) {
super();
@@ -73,4 +75,20 @@ export class ExtHostTreeExplorers extends ExtHostTreeExplorersShape {
});
}));
}
$resolveCommand(providerId: string, mainThreadNode: InternalTreeExplorerNode): TPromise<void> {
const provider = this._treeExplorerNodeProviders[providerId];
if (!provider) {
throw new Error(`no TreeContentProvider registered with id '${providerId}'`);
}
if (mainThreadNode.onClickCommand) {
return TPromise.wrap(this.commands.executeCommand(mainThreadNode.onClickCommand, this._externalNodeMaps[providerId][mainThreadNode.id]).then(() => {
// Todo: error handling
return null;
}));
}
return TPromise.as(null);
}
}