mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Focus projects view when New Project is created (#11048)
* Focusing for new project * Consolidated focus() logic
This commit is contained in:
@@ -88,14 +88,11 @@ export default class MainController implements Disposable {
|
||||
filter[constants.sqlDatabaseProject] = ['sqlproj'];
|
||||
|
||||
let files: Uri[] | undefined = await this.apiWrapper.showOpenDialog({ filters: filter });
|
||||
const prevCount = this.projectsController.projects.length;
|
||||
|
||||
if (files) {
|
||||
for (const file of files) {
|
||||
await this.projectsController.openProject(file);
|
||||
}
|
||||
|
||||
await this.projectsController.focusProject(this.projectsController.projects[prevCount]); // focus the first of the newly-opened projects
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
@@ -137,8 +134,10 @@ export default class MainController implements Disposable {
|
||||
// TODO: what if the selected folder is outside the workspace?
|
||||
|
||||
const newProjFolderUri = (selectionResult as Uri[])[0];
|
||||
const newProjFilePath = await this.projectsController.createNewProject(newProjName as string, newProjFolderUri as Uri);
|
||||
return this.projectsController.openProject(Uri.file(newProjFilePath));
|
||||
const newProjFilePath = await this.projectsController.createNewProject(<string>newProjName, newProjFolderUri);
|
||||
const proj = await this.projectsController.openProject(Uri.file(newProjFilePath));
|
||||
|
||||
return proj;
|
||||
}
|
||||
catch (err) {
|
||||
this.apiWrapper.showErrorMessage(getErrorMessage(err));
|
||||
|
||||
@@ -93,6 +93,7 @@ export class ProjectsController {
|
||||
|
||||
try {
|
||||
this.refreshProjectsTree();
|
||||
this.focusProject(newProject);
|
||||
}
|
||||
catch (err) {
|
||||
// if the project didnt load - remove it from the list of open projects
|
||||
@@ -641,8 +642,6 @@ export class ProjectsController {
|
||||
|
||||
//Refresh project to show the added files
|
||||
this.refreshProjectsTree();
|
||||
|
||||
await this.focusProject(project);
|
||||
}
|
||||
catch (err) {
|
||||
this.apiWrapper.showErrorMessage(utils.getErrorMessage(err));
|
||||
|
||||
Reference in New Issue
Block a user