mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -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:
43
extensions/sql-database-projects/src/common/iconHelper.ts
Normal file
43
extensions/sql-database-projects/src/common/iconHelper.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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';
|
||||
|
||||
export interface IconPath {
|
||||
dark: string;
|
||||
light: string;
|
||||
}
|
||||
|
||||
export class IconPathHelper {
|
||||
private static extensionContext: vscode.ExtensionContext;
|
||||
public static databaseProject: IconPath;
|
||||
|
||||
public static dataSourceGroup: IconPath;
|
||||
public static dataSourceSql: IconPath;
|
||||
|
||||
public static referenceGroup: IconPath;
|
||||
public static referenceDatabase: IconPath;
|
||||
|
||||
public static setExtensionContext(extensionContext: vscode.ExtensionContext) {
|
||||
IconPathHelper.extensionContext = extensionContext;
|
||||
|
||||
IconPathHelper.databaseProject = IconPathHelper.makeIcon('databaseProject');
|
||||
|
||||
IconPathHelper.dataSourceGroup = IconPathHelper.makeIcon('dataSourceGroup');
|
||||
IconPathHelper.dataSourceSql = IconPathHelper.makeIcon('dataSource-sql');
|
||||
|
||||
IconPathHelper.referenceGroup = IconPathHelper.makeIcon('referenceGroup');
|
||||
IconPathHelper.referenceDatabase = IconPathHelper.makeIcon('reference-database');
|
||||
}
|
||||
|
||||
private static makeIcon(name: string) {
|
||||
const folder = 'images';
|
||||
|
||||
return {
|
||||
dark: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/dark/${name}.svg`),
|
||||
light: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/light/${name}.svg`)
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user