Add option for using generic SQL queries to filter EditData rows via a query editor pane. (#1329)

This commit is contained in:
Cory Rivera
2018-05-14 12:27:55 -07:00
committed by GitHub
parent 6b549696c5
commit 89c48bbe75
27 changed files with 1075 additions and 293 deletions

View File

@@ -131,6 +131,16 @@ export abstract class EditorInput implements IEditorInput {
return this._onDispose.event;
}
// {{SQL CARBON EDIT}}
// Saving is not supported in the EditData query editor, so this can be overriden in its Input.
private _savingSupported: boolean = true;
public get savingSupported(): boolean {
return this._savingSupported;
}
public disableSaving() {
this._savingSupported = false;
}
/**
* Returns the associated resource of this input if any.
*/

View File

@@ -167,6 +167,11 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
}
public isDirty(): boolean {
// {{SQL CARBON EDIT}}
if (!this.savingSupported) {
return false;
}
if (this.cachedModel) {
return this.cachedModel.isDirty();
}

View File

@@ -11,7 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import * as labels from 'vs/base/common/labels';
import URI from 'vs/base/common/uri';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { toResource, IEditorCommandsContext } from 'vs/workbench/common/editor';
import { toResource, IEditorCommandsContext, EditorInput } from 'vs/workbench/common/editor';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
@@ -89,6 +89,11 @@ function save(resource: URI, isSaveAs: boolean, editorService: IWorkbenchEditorS
textFileService: ITextFileService, editorGroupService: IEditorGroupService, queryEditorService: IQueryEditorService,): TPromise<any> {
if (resource && (fileService.canHandleResource(resource) || resource.scheme === Schemas.untitled)) {
// {{SQL CARBON EDIT}}
let editorInput = editorService.getActiveEditorInput();
if (editorInput instanceof EditorInput && !(<EditorInput>editorInput).savingSupported) {
return TPromise.as(false);
}
// Save As (or Save untitled with associated path)
if (isSaveAs || resource.scheme === Schemas.untitled) {