mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
Show database references in project tree (#10837)
* add database references to same itemgroup * show database references in tree * update tests * refresh project tree after a reference is added * addressing comments * add validation * Add test * sort imports
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as constants from '../../common/constants';
|
||||
import { BaseProjectTreeItem, MessageTreeItem } from './baseTreeItem';
|
||||
import { ProjectRootTreeItem } from './projectTreeItem';
|
||||
|
||||
/**
|
||||
* Folder for containing references nodes in the tree
|
||||
*/
|
||||
export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
private references: MessageTreeItem[] = [];
|
||||
|
||||
constructor(project: ProjectRootTreeItem) {
|
||||
super(vscode.Uri.file(path.join(project.uri.path, constants.databaseReferencesNodeName)), project);
|
||||
|
||||
this.construct();
|
||||
}
|
||||
|
||||
private construct() {
|
||||
for (const reference of (this.parent as ProjectRootTreeItem).project.databaseReferences) {
|
||||
this.references.push(new MessageTreeItem(reference));
|
||||
}
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
return this.references;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
return new vscode.TreeItem(this.uri, vscode.TreeItemCollapsibleState.Collapsed);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user