mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 01:25:39 -05:00
Merge from vscode 1ce89e2cb720d69c496c2815c4696ee4fd4429a6 (#6779)
* Merge from vscode 1ce89e2cb720d69c496c2815c4696ee4fd4429a6 * redisable accounts because of issues
This commit is contained in:
@@ -164,9 +164,11 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
private domNode!: HTMLElement;
|
||||
private treeContainer!: HTMLElement;
|
||||
private _messageValue: string | undefined;
|
||||
private _canSelectMany: boolean = false;
|
||||
private messageElement!: HTMLDivElement;
|
||||
private tree: WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore> | undefined;
|
||||
private treeLabels: ResourceLabels | undefined;
|
||||
|
||||
private root: ITreeItem;
|
||||
private elementsToRefresh: ITreeItem[] = [];
|
||||
private menus: TitleMenus;
|
||||
@@ -253,6 +255,14 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
this.updateMessage();
|
||||
}
|
||||
|
||||
get canSelectMany(): boolean {
|
||||
return this._canSelectMany;
|
||||
}
|
||||
|
||||
set canSelectMany(canSelectMany: boolean) {
|
||||
this._canSelectMany = canSelectMany;
|
||||
}
|
||||
|
||||
get hasIconForParentNode(): boolean {
|
||||
return this._hasIconForParentNode;
|
||||
}
|
||||
@@ -372,12 +382,14 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
collapseByDefault: (e: ITreeItem): boolean => {
|
||||
return e.collapsibleState !== TreeItemCollapsibleState.Expanded;
|
||||
},
|
||||
multipleSelectionSupport: false
|
||||
}));
|
||||
multipleSelectionSupport: this.canSelectMany,
|
||||
}) as WorkbenchAsyncDataTree<ITreeItem, ITreeItem, FuzzyScore>);
|
||||
aligner.tree = this.tree;
|
||||
const actionRunner = new MultipleSelectionActionRunner(() => this.tree!.getSelection());
|
||||
renderer.actionRunner = actionRunner;
|
||||
|
||||
this.tree.contextKeyService.createKey<boolean>(this.id, true);
|
||||
this._register(this.tree.onContextMenu(e => this.onContextMenu(treeMenus, e)));
|
||||
this._register(this.tree.onContextMenu(e => this.onContextMenu(treeMenus, e, actionRunner)));
|
||||
this._register(this.tree.onDidChangeSelection(e => this._onDidChangeSelection.fire(e.elements)));
|
||||
this._register(this.tree.onDidChangeCollapseState(e => {
|
||||
if (!e.node.element) {
|
||||
@@ -406,7 +418,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
}));
|
||||
}
|
||||
|
||||
private onContextMenu(treeMenus: TreeMenus, treeEvent: ITreeContextMenuEvent<ITreeItem>): void {
|
||||
private onContextMenu(treeMenus: TreeMenus, treeEvent: ITreeContextMenuEvent<ITreeItem>, actionRunner: MultipleSelectionActionRunner): void {
|
||||
const node: ITreeItem | null = treeEvent.element;
|
||||
if (node === null) {
|
||||
return;
|
||||
@@ -442,7 +454,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
|
||||
getActionsContext: () => (<TreeViewItemHandleArg>{ $treeViewId: this.id, $treeItemHandle: node.handle }),
|
||||
|
||||
actionRunner: new MultipleSelectionActionRunner(() => this.tree!.getSelection())
|
||||
actionRunner
|
||||
});
|
||||
}
|
||||
|
||||
@@ -686,6 +698,8 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
static readonly ITEM_HEIGHT = 22;
|
||||
static readonly TREE_TEMPLATE_ID = 'treeExplorer';
|
||||
|
||||
private _actionRunner: MultipleSelectionActionRunner | undefined;
|
||||
|
||||
constructor(
|
||||
private treeViewId: string,
|
||||
private menus: TreeMenus,
|
||||
@@ -703,6 +717,10 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
return TreeRenderer.TREE_TEMPLATE_ID;
|
||||
}
|
||||
|
||||
set actionRunner(actionRunner: MultipleSelectionActionRunner) {
|
||||
this._actionRunner = actionRunner;
|
||||
}
|
||||
|
||||
renderTemplate(container: HTMLElement): ITreeExplorerTemplateData {
|
||||
DOM.addClass(container, 'custom-view-tree-node-item');
|
||||
|
||||
@@ -740,8 +758,11 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
|
||||
templateData.icon.style.backgroundImage = iconUrl ? `url('${DOM.asDomUri(iconUrl).toString(true)}')` : '';
|
||||
DOM.toggleClass(templateData.icon, 'custom-view-tree-node-item-icon', !!iconUrl);
|
||||
templateData.actionBar.context = (<TreeViewItemHandleArg>{ $treeViewId: this.treeViewId, $treeItemHandle: node.handle });
|
||||
templateData.actionBar.context = <TreeViewItemHandleArg>{ $treeViewId: this.treeViewId, $treeItemHandle: node.handle };
|
||||
templateData.actionBar.push(this.menus.getResourceActions(node), { icon: true, label: false });
|
||||
if (this._actionRunner) {
|
||||
templateData.actionBar.actionRunner = this._actionRunner;
|
||||
}
|
||||
this.setAlignment(templateData.container, node);
|
||||
templateData.elementDisposable = (this.themeService.onDidFileIconThemeChange(() => this.setAlignment(templateData.container, node)));
|
||||
}
|
||||
@@ -822,23 +843,23 @@ class Aligner extends Disposable {
|
||||
|
||||
class MultipleSelectionActionRunner extends ActionRunner {
|
||||
|
||||
constructor(private getSelectedResources: (() => any[])) {
|
||||
constructor(private getSelectedResources: (() => ITreeItem[])) {
|
||||
super();
|
||||
}
|
||||
|
||||
runAction(action: IAction, context: any): Promise<any> {
|
||||
if (action instanceof MenuItemAction) {
|
||||
const selection = this.getSelectedResources();
|
||||
const filteredSelection = selection.filter(s => s !== context);
|
||||
|
||||
if (selection.length === filteredSelection.length || selection.length === 1) {
|
||||
return action.run(context);
|
||||
}
|
||||
|
||||
return action.run(context, ...filteredSelection);
|
||||
runAction(action: IAction, context: TreeViewItemHandleArg): Promise<any> {
|
||||
const selection = this.getSelectedResources();
|
||||
let selectionHandleArgs: TreeViewItemHandleArg[] | undefined = undefined;
|
||||
if (selection.length > 1) {
|
||||
selectionHandleArgs = [];
|
||||
selection.forEach(selected => {
|
||||
if (selected.handle !== context.$treeItemHandle) {
|
||||
selectionHandleArgs!.push({ $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return super.runAction(action, context);
|
||||
return action.run(...[context, selectionHandleArgs]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Workbench } from 'vs/workbench/browser/workbench';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IProductService } from 'vs/platform/product/common/product';
|
||||
import { IProductService, IProductConfiguration } from 'vs/platform/product/common/product';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteAgentServiceImpl';
|
||||
import { RemoteAuthorityResolverService } from 'vs/platform/remote/browser/remoteAuthorityResolverService';
|
||||
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
@@ -33,7 +33,6 @@ import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { SignService } from 'vs/platform/sign/browser/signService';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
|
||||
import { ProductService } from 'vs/platform/product/browser/productService';
|
||||
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
|
||||
import { BACKUPS } from 'vs/platform/environment/common/environment';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
@@ -41,6 +40,7 @@ import { BrowserStorageService } from 'vs/platform/storage/browser/storageServic
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { getThemeTypeSelector, DARK, HIGH_CONTRAST, LIGHT } from 'vs/platform/theme/common/themeService';
|
||||
import { InMemoryUserDataProvider } from 'vs/workbench/services/userData/common/inMemoryUserDataProvider';
|
||||
import { registerWindowDriver } from 'vs/platform/driver/browser/driver';
|
||||
|
||||
class CodeRendererMain extends Disposable {
|
||||
|
||||
@@ -83,6 +83,11 @@ class CodeRendererMain extends Disposable {
|
||||
}));
|
||||
this._register(workbench.onShutdown(() => this.dispose()));
|
||||
|
||||
// Driver
|
||||
if (this.configuration.driver) {
|
||||
registerWindowDriver().then(d => this._register(d));
|
||||
}
|
||||
|
||||
// Startup
|
||||
workbench.startup();
|
||||
}
|
||||
@@ -117,16 +122,11 @@ class CodeRendererMain extends Disposable {
|
||||
const payload = await this.resolveWorkspaceInitializationPayload();
|
||||
|
||||
// Environment
|
||||
const environmentService = new BrowserWorkbenchEnvironmentService({
|
||||
workspaceId: payload.id,
|
||||
remoteAuthority: this.configuration.remoteAuthority,
|
||||
webviewEndpoint: this.configuration.webviewEndpoint,
|
||||
connectionToken: this.configuration.connectionToken
|
||||
});
|
||||
const environmentService = new BrowserWorkbenchEnvironmentService(payload.id, this.configuration);
|
||||
serviceCollection.set(IWorkbenchEnvironmentService, environmentService);
|
||||
|
||||
// Product
|
||||
const productService = new ProductService();
|
||||
const productService = this.createProductService();
|
||||
serviceCollection.set(IProductService, productService);
|
||||
|
||||
// Remote
|
||||
@@ -192,6 +192,18 @@ class CodeRendererMain extends Disposable {
|
||||
return { serviceCollection, logService, storageService: services[1] };
|
||||
}
|
||||
|
||||
private createProductService(): IProductService {
|
||||
const element = document.getElementById('vscode-remote-product-configuration');
|
||||
const productConfiguration: IProductConfiguration = {
|
||||
...element ? JSON.parse(element.getAttribute('data-settings')!) : {
|
||||
version: '1.38.0-unknown',
|
||||
nameLong: 'Unknown',
|
||||
extensionAllowedProposedApi: [],
|
||||
}, ...{ urlProtocol: '', enableTelemetry: false }
|
||||
};
|
||||
return { _serviceBrand: undefined, ...productConfiguration };
|
||||
}
|
||||
|
||||
private async createStorageService(payload: IWorkspaceInitializationPayload, environmentService: IWorkbenchEnvironmentService, fileService: IFileService, logService: ILogService): Promise<BrowserStorageService> {
|
||||
const storageService = new BrowserStorageService(environmentService, fileService);
|
||||
|
||||
|
||||
@@ -422,6 +422,8 @@ export class SimpleWindowService extends Disposable implements IWindowService {
|
||||
}
|
||||
|
||||
closeWindow(): Promise<void> {
|
||||
window.close();
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -751,13 +753,13 @@ export class SimpleWindowsService implements IWindowsService {
|
||||
async openAboutDialog(): Promise<void> {
|
||||
const detail = localize('aboutDetail',
|
||||
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
||||
this.productService.productConfiguration.version || 'Unknown',
|
||||
this.productService.productConfiguration.commit || 'Unknown',
|
||||
this.productService.productConfiguration.date || 'Unknown',
|
||||
this.productService.version || 'Unknown',
|
||||
this.productService.commit || 'Unknown',
|
||||
this.productService.date || 'Unknown',
|
||||
navigator.userAgent
|
||||
);
|
||||
|
||||
const result = await this.dialogService.show(Severity.Info, this.productService.productConfiguration.nameLong, [localize('copy', "Copy"), localize('ok', "OK")], { detail });
|
||||
const result = await this.dialogService.show(Severity.Info, this.productService.nameLong, [localize('copy', "Copy"), localize('ok', "OK")], { detail });
|
||||
|
||||
if (result === 0) {
|
||||
this.clipboardService.writeText(detail);
|
||||
@@ -857,7 +859,7 @@ registerSingleton(ITunnelService, SimpleTunnelService);
|
||||
|
||||
//#region workspace stats
|
||||
|
||||
class WorkspaceStatsService implements IWorkspaceStatsService {
|
||||
class SimpleWorkspaceStatsService implements IWorkspaceStatsService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
@@ -875,6 +877,6 @@ class WorkspaceStatsService implements IWorkspaceStatsService {
|
||||
|
||||
}
|
||||
|
||||
registerSingleton(IWorkspaceStatsService, WorkspaceStatsService);
|
||||
registerSingleton(IWorkspaceStatsService, SimpleWorkspaceStatsService);
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user