mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 01:25:38 -05:00
Add option for using generic SQL queries to filter EditData rows via a query editor pane. (#1329)
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user