mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-25 06:10:30 -04:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'vs/css!./media/sidebarpart';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import nls = require('vs/nls');
|
||||
import * as nls from 'vs/nls';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { CompositePart } from 'vs/workbench/browser/parts/compositePart';
|
||||
@@ -21,12 +21,14 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import Event from 'vs/base/common/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SIDE_BAR_TITLE_FOREGROUND, SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND, SIDE_BAR_BORDER } from 'vs/workbench/common/theme';
|
||||
import { Dimension } from 'vs/base/browser/builder';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { Dimension, EventType } from 'vs/base/browser/dom';
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
|
||||
export class SidebarPart extends CompositePart<Viewlet> {
|
||||
|
||||
@@ -75,11 +77,18 @@ export class SidebarPart extends CompositePart<Viewlet> {
|
||||
return this._onDidCompositeClose.event as Event<IViewlet>;
|
||||
}
|
||||
|
||||
public createTitleArea(parent: HTMLElement): HTMLElement {
|
||||
const titleArea = super.createTitleArea(parent);
|
||||
$(titleArea).on(EventType.CONTEXT_MENU, (e: MouseEvent) => this.onTitleAreaContextMenu(new StandardMouseEvent(e)));
|
||||
|
||||
return titleArea;
|
||||
}
|
||||
|
||||
public updateStyles(): void {
|
||||
super.updateStyles();
|
||||
|
||||
// Part container
|
||||
const container = this.getContainer();
|
||||
const container = $(this.getContainer());
|
||||
|
||||
container.style('background-color', this.getColor(SIDE_BAR_BACKGROUND));
|
||||
container.style('color', this.getColor(SIDE_BAR_FOREGROUND));
|
||||
@@ -132,6 +141,23 @@ export class SidebarPart extends CompositePart<Viewlet> {
|
||||
|
||||
return super.layout(dimension);
|
||||
}
|
||||
|
||||
private onTitleAreaContextMenu(event: StandardMouseEvent): void {
|
||||
const activeViewlet = this.getActiveViewlet() as Viewlet;
|
||||
if (activeViewlet) {
|
||||
const contextMenuActions = activeViewlet ? activeViewlet.getContextMenuActions() : [];
|
||||
if (contextMenuActions.length) {
|
||||
const anchor: { x: number, y: number } = { x: event.posx, y: event.posy };
|
||||
this.contextMenuService.showContextMenu({
|
||||
getAnchor: () => anchor,
|
||||
getActions: () => TPromise.as(contextMenuActions),
|
||||
getActionItem: action => this.actionItemProvider(action as Action),
|
||||
actionRunner: activeViewlet.getActionRunner(),
|
||||
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FocusSideBarAction extends Action {
|
||||
|
||||
Reference in New Issue
Block a user