diff --git a/src/java/hierarchicalPackageNodeData.ts b/src/java/hierarchicalPackageNodeData.ts index 2f33eeb2..33ac4d44 100644 --- a/src/java/hierarchicalPackageNodeData.ts +++ b/src/java/hierarchicalPackageNodeData.ts @@ -18,15 +18,15 @@ export class HierarchicalPackageNodeData implements INodeData { private nodeData: INodeData = null; public get uri() { - return this.nodeData.uri; + return this.nodeData && this.nodeData.uri; } public get moduleName() { - return this.nodeData.moduleName; + return this.nodeData && this.nodeData.moduleName; } public get path() { - return this.nodeData.path; + return this.nodeData && this.nodeData.path; } public get kind() { diff --git a/src/views/dataNode.ts b/src/views/dataNode.ts index 93d72c9c..4e182169 100644 --- a/src/views/dataNode.ts +++ b/src/views/dataNode.ts @@ -14,6 +14,7 @@ export abstract class DataNode extends ExplorerNode { public getTreeItem(): TreeItem | Promise { if (this._nodeData) { const item = new TreeItem(this._nodeData.name, this.hasChildren() ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None); + item.description = this.description; item.iconPath = this.iconPath; item.command = this.command; item.contextValue = this.computeContextValue(); @@ -80,6 +81,10 @@ export abstract class DataNode extends ExplorerNode { return true; } + protected get description(): string | boolean { + return undefined; + } + protected get contextValue(): string { return undefined; } diff --git a/src/views/hierarchicalPackageNode.ts b/src/views/hierarchicalPackageNode.ts index e5737b0c..0a1f2028 100644 --- a/src/views/hierarchicalPackageNode.ts +++ b/src/views/hierarchicalPackageNode.ts @@ -21,9 +21,7 @@ export class HierarchicalPackageNode extends PackageNode { if (this._nodeData) { const item = new TreeItem(this.getHierarchicalNodeData().displayName, this.hasChildren() ? TreeItemCollapsibleState.Collapsed : TreeItemCollapsibleState.None); - item.iconPath = this.iconPath; - item.command = this.command; - return item; + return { ...super.getTreeItem(), ...item }; } } diff --git a/src/views/packageRootNode.ts b/src/views/packageRootNode.ts index 72dc2a94..6d039276 100644 --- a/src/views/packageRootNode.ts +++ b/src/views/packageRootNode.ts @@ -42,6 +42,15 @@ export class PackageRootNode extends DataNode { return result; } + protected get description(): string | boolean { + const data = this.nodeData; + if (data.entryKind === PackageRootKind.K_BINARY) { + return data.path; + } else { + return undefined; + } + } + protected get contextValue(): string { const data = this.nodeData; if (data.entryKind === PackageRootKind.K_BINARY) {