mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 17:22:25 -05:00
Adding icons to Database Projects' tree view (#11488)
* Add images * Splitting to light and dark mode icons * Hooks up icons to treeItems * updating package.json with new icon and vbump * move icon loader before tree view created
This commit is contained in:
@@ -6,14 +6,17 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as constants from '../../common/constants';
|
||||
import { BaseProjectTreeItem, MessageTreeItem } from './baseTreeItem';
|
||||
|
||||
import { BaseProjectTreeItem } from './baseTreeItem';
|
||||
import { ProjectRootTreeItem } from './projectTreeItem';
|
||||
import { IconPathHelper } from '../../common/iconHelper';
|
||||
import { DatabaseReferenceProjectEntry } from '../../models/project';
|
||||
|
||||
/**
|
||||
* Folder for containing references nodes in the tree
|
||||
*/
|
||||
export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
private references: MessageTreeItem[] = [];
|
||||
private references: DatabaseReferenceTreeItem[] = [];
|
||||
|
||||
constructor(project: ProjectRootTreeItem) {
|
||||
super(vscode.Uri.file(path.join(project.uri.path, constants.databaseReferencesNodeName)), project);
|
||||
@@ -23,17 +26,38 @@ export class DatabaseReferencesTreeItem extends BaseProjectTreeItem {
|
||||
|
||||
private construct() {
|
||||
for (const reference of (this.parent as ProjectRootTreeItem).project.databaseReferences) {
|
||||
this.references.push(new MessageTreeItem(reference.databaseName));
|
||||
this.references.push(new DatabaseReferenceTreeItem(reference, this));
|
||||
}
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
public get children(): DatabaseReferenceTreeItem[] {
|
||||
return this.references;
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const refFolderItem = new vscode.TreeItem(this.uri, vscode.TreeItemCollapsibleState.Collapsed);
|
||||
refFolderItem.contextValue = constants.DatabaseProjectItemType.referencesRoot;
|
||||
refFolderItem.iconPath = IconPathHelper.referenceGroup;
|
||||
|
||||
return refFolderItem;
|
||||
}
|
||||
}
|
||||
|
||||
export class DatabaseReferenceTreeItem extends BaseProjectTreeItem {
|
||||
constructor(private reference: DatabaseReferenceProjectEntry, referencesTreeItem: DatabaseReferencesTreeItem) {
|
||||
super(vscode.Uri.file(path.join(referencesTreeItem.uri.path, reference.databaseName)), referencesTreeItem);
|
||||
}
|
||||
|
||||
public get children(): BaseProjectTreeItem[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
public get treeItem(): vscode.TreeItem {
|
||||
const refItem = new vscode.TreeItem(this.uri, vscode.TreeItemCollapsibleState.None);
|
||||
refItem.label = this.reference.databaseName;
|
||||
refItem.contextValue = constants.DatabaseProjectItemType.reference;
|
||||
refItem.iconPath = IconPathHelper.referenceDatabase;
|
||||
|
||||
return refItem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user