Replace setCurrentDatabaseItem with openDatabase
This commit is contained in:
@@ -633,7 +633,7 @@ export class DatabaseUI extends DisposableObject {
|
|||||||
this.queryServer?.cliServer,
|
this.queryServer?.cliServer,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await this.setCurrentDatabase(progress, token, uri);
|
await this.databaseManager.openDatabase(progress, token, uri);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// rethrow and let this be handled by default error handling.
|
// rethrow and let this be handled by default error handling.
|
||||||
@@ -755,27 +755,6 @@ export class DatabaseUI extends DisposableObject {
|
|||||||
return this.databaseManager.currentDatabaseItem;
|
return this.databaseManager.currentDatabaseItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async setCurrentDatabase(
|
|
||||||
progress: ProgressCallback,
|
|
||||||
token: CancellationToken,
|
|
||||||
uri: Uri,
|
|
||||||
): Promise<DatabaseItem | undefined> {
|
|
||||||
let databaseItem = this.databaseManager.findDatabaseItem(uri);
|
|
||||||
|
|
||||||
const makeSelected = true;
|
|
||||||
|
|
||||||
if (databaseItem === undefined) {
|
|
||||||
databaseItem = await this.databaseManager.openDatabase(
|
|
||||||
progress,
|
|
||||||
token,
|
|
||||||
uri,
|
|
||||||
makeSelected,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return databaseItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the user for a database directory. Returns the chosen database, or `undefined` if the
|
* Ask the user for a database directory. Returns the chosen database, or `undefined` if the
|
||||||
* operation was canceled.
|
* operation was canceled.
|
||||||
@@ -795,7 +774,11 @@ export class DatabaseUI extends DisposableObject {
|
|||||||
if (byFolder) {
|
if (byFolder) {
|
||||||
const fixedUri = await this.fixDbUri(uri);
|
const fixedUri = await this.fixDbUri(uri);
|
||||||
// we are selecting a database folder
|
// we are selecting a database folder
|
||||||
return await this.setCurrentDatabase(progress, token, fixedUri);
|
return await this.databaseManager.openDatabase(
|
||||||
|
progress,
|
||||||
|
token,
|
||||||
|
fixedUri,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// we are selecting a database archive. Must unzip into a workspace-controlled area
|
// we are selecting a database archive. Must unzip into a workspace-controlled area
|
||||||
// before importing.
|
// before importing.
|
||||||
|
|||||||
Reference in New Issue
Block a user