mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Update sql projects tree to use sqlproj uri instead of parent nodes (#21901)
* update sql projects tree to use sqlproj uri instead of parent nodes * remove todo * undo other change * update a couple more
This commit is contained in:
@@ -18,15 +18,26 @@ import { IDatabaseReferenceProjectEntry } from 'sqldbproj';
|
||||
export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
private references: DatabaseReferenceTreeItem[] = [];
|
||||
|
||||
constructor(project: ProjectRootTreeItem) {
|
||||
super(vscode.Uri.file(path.join(project.relativeProjectUri.fsPath, constants.databaseReferencesNodeName)), project);
|
||||
/**
|
||||
* Constructor
|
||||
* @param projectNodeName Name of the project node. Used for creating the relative path of the Database References node to the project
|
||||
* @param sqlprojUri Full URI to the .sqlproj
|
||||
* @param databaseReferences Array of database references in the project
|
||||
* @param project
|
||||
*/
|
||||
constructor(projectNodeName: string, sqlprojUri: vscode.Uri, databaseReferences: IDatabaseReferenceProjectEntry[], project: ProjectRootTreeItem) {
|
||||
super(vscode.Uri.file(path.join(projectNodeName, constants.databaseReferencesNodeName)), sqlprojUri, project);
|
||||
|
||||
this.construct();
|
||||
this.construct(databaseReferences);
|
||||
}
|
||||
|
||||
private construct() {
|
||||
for (const reference of (this.parent as ProjectRootTreeItem).project.databaseReferences) {
|
||||
this.references.push(new DatabaseReferenceTreeItem(reference, this));
|
||||
private construct(databaseReferences: IDatabaseReferenceProjectEntry[]) {
|
||||
if (!databaseReferences) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const reference of databaseReferences) {
|
||||
this.references.push(new DatabaseReferenceTreeItem(reference, this.relativeProjectUri, this.sqlprojUri, this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +55,8 @@ export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
}
|
||||
|
||||
export class DatabaseReferenceTreeItem extends BaseProjectTreeItem {
|
||||
constructor(private reference: IDatabaseReferenceProjectEntry, referencesTreeItem: DatabaseReferencesTreeItem) {
|
||||
super(vscode.Uri.file(path.join(referencesTreeItem.relativeProjectUri.fsPath, reference.databaseName)), referencesTreeItem);
|
||||
constructor(private reference: IDatabaseReferenceProjectEntry, referencesNodeRelativeProjectUri: vscode.Uri, sqlprojUri: vscode.Uri, referencesTreeItem: DatabaseReferencesTreeItem) {
|
||||
super(vscode.Uri.file(path.join(referencesNodeRelativeProjectUri.fsPath, reference.databaseName)), sqlprojUri, referencesTreeItem);
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
|
||||
Reference in New Issue
Block a user