Add Data Explorer Context and apply to disconnect (#4265)

* adding context

* apply extension changes

* shimming disconnect

* add data explorer context menu and add disconnect to it

* clean up shim code; better handle errors

* remove tpromise

* simplify code

* add node context on data explorer

* formatting

* fix various errors with how the context menus work
This commit is contained in:
Anthony Dresser
2019-03-05 17:09:00 -08:00
committed by GitHub
parent 7eaf8cfd2f
commit da06a96630
7 changed files with 153 additions and 58 deletions

View File

@@ -386,41 +386,6 @@ export class DeleteConnectionAction extends Action {
}
}
class DisconnectProfileAction extends Action {
constructor(
@IOEShimService private objectExplorerService: IOEShimService
) {
super(DisconnectConnectionAction.ID);
}
run(args: TreeViewItemHandleArg): Promise<boolean> {
if (args.$treeItem) {
return this.objectExplorerService.disconnectNode(args.$treeViewId, args.$treeItem).then(() => {
const { treeView } = (<ICustomViewDescriptor>ViewsRegistry.getView(args.$treeViewId));
// we need to collapse it then refresh it so that the tree doesn't try and use it's cache next time the user expands the node
return treeView.collapse(args.$treeItem).then(() => treeView.refresh([args.$treeItem]).then(() => true));
});
}
return Promise.resolve(true);
}
}
CommandsRegistry.registerCommand({
id: DisconnectConnectionAction.ID,
handler: (accessor, args: TreeViewItemHandleArg) => {
return accessor.get(IInstantiationService).createInstance(DisconnectProfileAction).run(args);
}
});
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
group: 'connection',
order: 4,
command: {
id: DisconnectConnectionAction.ID,
title: DisconnectConnectionAction.LABEL
}
});
/**
* Action to clear search results
*/