make events to open new sql query window (#2688)

This commit is contained in:
Alan Ren
2018-09-25 09:47:52 -07:00
committed by GitHub
parent bb5d52d72c
commit 77c997b91e
3 changed files with 15 additions and 6 deletions

View File

@@ -46,6 +46,9 @@ import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem'; import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
// {{SQL CARBON EDIT}}
import { ICommandService } from 'vs/platform/commands/common/commands';
import { GlobalNewUntitledFileAction } from 'vs/workbench/parts/files/electron-browser/fileActions';
export class EditorGroupView extends Themable implements IEditorGroupView { export class EditorGroupView extends Themable implements IEditorGroupView {
@@ -126,7 +129,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
@IUntitledEditorService private untitledEditorService: IUntitledEditorService, @IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IKeybindingService private keybindingService: IKeybindingService, @IKeybindingService private keybindingService: IKeybindingService,
@IMenuService private menuService: IMenuService, @IMenuService private menuService: IMenuService,
@IContextMenuService private contextMenuService: IContextMenuService @IContextMenuService private contextMenuService: IContextMenuService,
// {{SQL CARBON EDIT}}
@ICommandService private commandService: ICommandService
) { ) {
super(themeService); super(themeService);
@@ -244,8 +249,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._register(addDisposableListener(this.element, EventType.DBLCLICK, e => { this._register(addDisposableListener(this.element, EventType.DBLCLICK, e => {
if (this.isEmpty()) { if (this.isEmpty()) {
EventHelper.stop(e); EventHelper.stop(e);
// {{SQL CARBON EDIT}}
this.openEditor(this.untitledEditorService.createOrGet(), EditorOptions.create({ pinned: true })); this.commandService.executeCommand(GlobalNewUntitledFileAction.ID).done(undefined, err => this.notificationService.warn(err));
} }
})); }));

View File

@@ -51,6 +51,8 @@ import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement'; import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService'; import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService'; import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { GlobalNewUntitledFileAction } from 'vs/workbench/parts/files/electron-browser/fileActions';
interface IEditorInputLabel { interface IEditorInputLabel {
name: string; name: string;
@@ -94,6 +96,7 @@ export class TabsTitleControl extends TitleControl {
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService configurationService: IConfigurationService,
// {{SQL CARBON EDIT}} -- Display the editor's tab color // {{SQL CARBON EDIT}} -- Display the editor's tab color
@IWorkspaceConfigurationService private workspaceConfigurationService: IWorkspaceConfigurationService, @IWorkspaceConfigurationService private workspaceConfigurationService: IWorkspaceConfigurationService,
@ICommandService private commandService: ICommandService,
@IConnectionManagementService private connectionService: IConnectionManagementService, @IConnectionManagementService private connectionService: IConnectionManagementService,
@IQueryEditorService private queryEditorService: IQueryEditorService, @IQueryEditorService private queryEditorService: IQueryEditorService,
@IObjectExplorerService private objectExplorerService: IObjectExplorerService @IObjectExplorerService private objectExplorerService: IObjectExplorerService
@@ -178,8 +181,8 @@ export class TabsTitleControl extends TitleControl {
this._register(addDisposableListener(this.tabsContainer, EventType.DBLCLICK, e => { this._register(addDisposableListener(this.tabsContainer, EventType.DBLCLICK, e => {
if (e.target === this.tabsContainer) { if (e.target === this.tabsContainer) {
EventHelper.stop(e); EventHelper.stop(e);
// {{SQL CARBON EDIT}}
this.group.openEditor(this.untitledEditorService.createOrGet(), { pinned: true /* untitled is always pinned */, index: this.group.count /* always at the end */ }); this.commandService.executeCommand(GlobalNewUntitledFileAction.ID).done(undefined, err => this.notificationService.warn(err));
} }
})); }));

View File

@@ -73,7 +73,8 @@ export abstract class TitleControl extends Themable {
@IContextKeyService private contextKeyService: IContextKeyService, @IContextKeyService private contextKeyService: IContextKeyService,
@IKeybindingService private keybindingService: IKeybindingService, @IKeybindingService private keybindingService: IKeybindingService,
@ITelemetryService private telemetryService: ITelemetryService, @ITelemetryService private telemetryService: ITelemetryService,
@INotificationService private notificationService: INotificationService, // {{SQL CARBON EDIT}} -- need to make the notification service protected
@INotificationService protected notificationService: INotificationService,
@IMenuService private menuService: IMenuService, @IMenuService private menuService: IMenuService,
@IQuickOpenService protected quickOpenService: IQuickOpenService, @IQuickOpenService protected quickOpenService: IQuickOpenService,
@IThemeService themeService: IThemeService, @IThemeService themeService: IThemeService,