Add scripting contributions for explorer widget (#7830)

* add scripting contributions for explorer widget

* utilize or
This commit is contained in:
Anthony Dresser
2019-10-18 14:26:43 -07:00
committed by GitHub
parent f631a8aa9a
commit 4c8f3ddfd3
6 changed files with 167 additions and 190 deletions

View File

@@ -11,7 +11,7 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
import { IOEShimService } from 'sql/workbench/parts/objectExplorer/browser/objectExplorerViewTreeShim';
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { BaseActionContext } from 'sql/workbench/browser/actions';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { ScriptCreateAction, ScriptDeleteAction, ScriptSelectAction, ScriptExecuteAction, ScriptAlterAction, EditDataAction } from 'sql/workbench/browser/scriptingActions';
@@ -343,3 +343,73 @@ CommandsRegistry.registerCommand({
}
});
//#endregion
//#region -- explorer widget
export class ExplorerScriptSelectAction extends ScriptSelectAction {
constructor(
id: string, label: string,
@IQueryEditorService queryEditorService: IQueryEditorService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IProgressService private readonly progressService: IProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService);
}
public run(actionContext: BaseActionContext): Promise<boolean> {
return this.progressService.withProgress({ location: ProgressLocation.Window }, () => super.run(actionContext));
}
}
export class ExplorerScriptCreateAction extends ScriptCreateAction {
constructor(
id: string, label: string,
@IQueryEditorService queryEditorService: IQueryEditorService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IErrorMessageService errorMessageService: IErrorMessageService,
@IProgressService private readonly progressService: IProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
}
public run(actionContext: BaseActionContext): Promise<boolean> {
return this.progressService.withProgress({ location: ProgressLocation.Window }, () => super.run(actionContext));
}
}
export class ExplorerScriptAlterAction extends ScriptAlterAction {
constructor(
id: string, label: string,
@IQueryEditorService queryEditorService: IQueryEditorService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IErrorMessageService errorMessageService: IErrorMessageService,
@IProgressService private readonly progressService: IProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
}
public run(actionContext: BaseActionContext): Promise<boolean> {
return this.progressService.withProgress({ location: ProgressLocation.Window }, () => super.run(actionContext));
}
}
export class ExplorerScriptExecuteAction extends ScriptExecuteAction {
constructor(
id: string, label: string,
@IQueryEditorService queryEditorService: IQueryEditorService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IErrorMessageService errorMessageService: IErrorMessageService,
@IProgressService private readonly progressService: IProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
}
public run(actionContext: BaseActionContext): Promise<boolean> {
return this.progressService.withProgress({ location: ProgressLocation.Window }, () => super.run(actionContext));
}
}
//#endregion