mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
This reverts commit d15a3fcc98.
This commit is contained in:
@@ -28,7 +28,7 @@ import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction } from 'vs/
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { fillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
|
||||
@@ -61,7 +61,7 @@ export class ElectronWindow extends Disposable {
|
||||
|
||||
private touchBarMenu?: IMenu;
|
||||
private touchBarUpdater: RunOnceScheduler;
|
||||
private readonly touchBarDisposables = this._register(new DisposableStore());
|
||||
private touchBarDisposables: IDisposable[];
|
||||
private lastInstalledTouchedBar: ICommandAction[][];
|
||||
|
||||
private previousConfiguredZoomLevel: number;
|
||||
@@ -95,6 +95,8 @@ export class ElectronWindow extends Disposable {
|
||||
) {
|
||||
super();
|
||||
|
||||
this.touchBarDisposables = [];
|
||||
|
||||
this.pendingFoldersToAdd = [];
|
||||
this.addFoldersScheduler = this._register(new RunOnceScheduler(() => this.doAddFolders(), 100));
|
||||
|
||||
@@ -312,24 +314,22 @@ export class ElectronWindow extends Disposable {
|
||||
this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure }));
|
||||
|
||||
// Root warning
|
||||
this.lifecycleService.when(LifecyclePhase.Restored).then(() => {
|
||||
let isAdminPromise: Promise<boolean>;
|
||||
this.lifecycleService.when(LifecyclePhase.Restored).then(async () => {
|
||||
let isAdmin: boolean;
|
||||
if (isWindows) {
|
||||
isAdminPromise = import('native-is-elevated').then(isElevated => isElevated()); // not using async here due to https://github.com/microsoft/vscode/issues/74321
|
||||
const isElevated = await import('native-is-elevated');
|
||||
isAdmin = isElevated();
|
||||
} else {
|
||||
isAdminPromise = Promise.resolve(isRootUser());
|
||||
isAdmin = isRootUser();
|
||||
}
|
||||
|
||||
return isAdminPromise.then(isAdmin => {
|
||||
// Update title
|
||||
this.titleService.updateProperties({ isAdmin });
|
||||
|
||||
// Update title
|
||||
this.titleService.updateProperties({ isAdmin });
|
||||
|
||||
// Show warning message (unix only)
|
||||
if (isAdmin && !isWindows) {
|
||||
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
|
||||
}
|
||||
});
|
||||
// Show warning message (unix only)
|
||||
if (isAdmin && !isWindows) {
|
||||
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
|
||||
}
|
||||
});
|
||||
|
||||
// Touchbar menu (if enabled)
|
||||
@@ -350,20 +350,20 @@ export class ElectronWindow extends Disposable {
|
||||
}
|
||||
|
||||
// Dispose old
|
||||
this.touchBarDisposables.clear();
|
||||
this.touchBarDisposables = dispose(this.touchBarDisposables);
|
||||
this.touchBarMenu = undefined;
|
||||
|
||||
// Create new (delayed)
|
||||
this.touchBarUpdater = new RunOnceScheduler(() => this.doUpdateTouchbarMenu(), 300);
|
||||
this.touchBarDisposables.add(this.touchBarUpdater);
|
||||
this.touchBarDisposables.push(this.touchBarUpdater);
|
||||
this.touchBarUpdater.schedule();
|
||||
}
|
||||
|
||||
private doUpdateTouchbarMenu(): void {
|
||||
if (!this.touchBarMenu) {
|
||||
this.touchBarMenu = this.editorService.invokeWithinEditorContext(accessor => this.menuService.createMenu(MenuId.TouchBarContext, accessor.get(IContextKeyService)));
|
||||
this.touchBarDisposables.add(this.touchBarMenu);
|
||||
this.touchBarDisposables.add(this.touchBarMenu.onDidChange(() => this.touchBarUpdater.schedule()));
|
||||
this.touchBarDisposables.push(this.touchBarMenu);
|
||||
this.touchBarDisposables.push(this.touchBarMenu.onDidChange(() => this.touchBarUpdater.schedule()));
|
||||
}
|
||||
|
||||
const actions: Array<MenuItemAction | Separator> = [];
|
||||
@@ -531,4 +531,10 @@ export class ElectronWindow extends Disposable {
|
||||
// Otherwise open all
|
||||
return this.editorService.openEditors(resources);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.touchBarDisposables = dispose(this.touchBarDisposables);
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user