diff --git a/src/views/PrimaryTypeNode.ts b/src/views/PrimaryTypeNode.ts index 8ee95223..0d80bf8b 100644 --- a/src/views/PrimaryTypeNode.ts +++ b/src/views/PrimaryTypeNode.ts @@ -34,6 +34,10 @@ export class PrimaryTypeNode extends DataNode { return ""; } + public getLabel(): string { + return this._nodeData.displayName ?? this._nodeData.name; + } + protected async loadData(): Promise { if (!this.hasChildren() || !this.nodeData.uri) { return undefined; diff --git a/src/views/containerNode.ts b/src/views/containerNode.ts index 8117dce4..06bc9930 100644 --- a/src/views/containerNode.ts +++ b/src/views/containerNode.ts @@ -44,11 +44,7 @@ export class ContainerNode extends DataNode { } public getLabel(): string { - if (this._nodeData.metaData?.['maven.groupId']) { - return `${this._nodeData.metaData?.['maven.groupId']}:${this._nodeData.metaData?.['maven.artifactId']}:${this._nodeData.metaData?.['maven.version']}`; - } else { - return this._nodeData.displayName ?? this._nodeData.name; - } + return this._nodeData.displayName ?? this._nodeData.name; } public isMavenType(): boolean { diff --git a/src/views/dataNode.ts b/src/views/dataNode.ts index 870ccab2..e0292a0e 100644 --- a/src/views/dataNode.ts +++ b/src/views/dataNode.ts @@ -42,14 +42,6 @@ export abstract class DataNode extends ExplorerNode { return item; } - public getLabel(): string { - if (this._nodeData.metaData?.['maven.groupId']) { - return `${this._nodeData.metaData?.['maven.groupId']}:${this._nodeData.metaData?.['maven.artifactId']}:${this._nodeData.metaData?.['maven.version']}`; - } else { - return this._nodeData.displayName ?? this._nodeData.name; - } - } - public get nodeData(): INodeData { return this._nodeData; } diff --git a/src/views/dependencyDataProvider.ts b/src/views/dependencyDataProvider.ts index 21802b8c..ba42d3fe 100644 --- a/src/views/dependencyDataProvider.ts +++ b/src/views/dependencyDataProvider.ts @@ -125,7 +125,7 @@ export class DependencyDataProvider implements TreeDataProvider { await this.getRootNodes() : await element.getChildren(); if (children && element instanceof ContainerNode) { - if (element.isMavenType() || element.isGradleType()) { + if (element.isMavenType()) { children.sort((a, b) => { return a.getLabel().localeCompare(b.getLabel()); }); diff --git a/src/views/fileNode.ts b/src/views/fileNode.ts index 851afafa..e593f10c 100644 --- a/src/views/fileNode.ts +++ b/src/views/fileNode.ts @@ -13,6 +13,10 @@ export class FileNode extends DataNode { super(nodeData, parent); } + public getLabel(): string { + return this._nodeData.displayName ?? this._nodeData.name; + } + protected hasChildren(): boolean { return false; } diff --git a/src/views/folderNode.ts b/src/views/folderNode.ts index 609b799b..45529b31 100644 --- a/src/views/folderNode.ts +++ b/src/views/folderNode.ts @@ -15,6 +15,10 @@ export class FolderNode extends DataNode { super(nodeData, parent); } + public getLabel(): string { + return this._nodeData.displayName ?? this._nodeData.name; + } + protected async loadData(): Promise { return Jdtls.getPackageData({ kind: NodeKind.Folder, diff --git a/src/views/packageNode.ts b/src/views/packageNode.ts index a6151435..83f7589c 100644 --- a/src/views/packageNode.ts +++ b/src/views/packageNode.ts @@ -22,6 +22,10 @@ export class PackageNode extends DataNode { return parentData.entryKind === PackageRootKind.K_SOURCE || parentData.kind === NodeKind.Project; } + public getLabel(): string { + return this._nodeData.displayName ?? this._nodeData.name; + } + protected async loadData(): Promise { return Jdtls.getPackageData({ kind: NodeKind.Package, diff --git a/src/views/packageRootNode.ts b/src/views/packageRootNode.ts index 63de2c65..e64252d7 100644 --- a/src/views/packageRootNode.ts +++ b/src/views/packageRootNode.ts @@ -8,7 +8,7 @@ import { INodeData, NodeKind } from "../java/nodeData"; import { IPackageRootNodeData, PackageRootKind } from "../java/packageRootNodeData"; import { Settings } from "../settings"; import { isTest } from "../utility"; -import { ContainerNode } from "./containerNode"; +import { ContainerNode, ContainerType } from "./containerNode"; import { DataNode } from "./dataNode"; import { ExplorerNode } from "./explorerNode"; import { ProjectNode } from "./projectNode"; @@ -20,6 +20,16 @@ export class PackageRootNode extends DataNode { super(nodeData, parent); } + public getLabel(): string { + if (this.getParent() instanceof ContainerNode) { + const parent = this.getParent() as ContainerNode; + if (parent.getContainerType() == ContainerType.Maven) { + return `${this._nodeData.metaData?.['maven.groupId']}:${this._nodeData.metaData?.['maven.artifactId']}:${this._nodeData.metaData?.['maven.version']}`; + } + } + return this._nodeData.displayName ?? this._nodeData.name; + } + public isSourceRoot(): boolean { return (this.nodeData).entryKind === PackageRootKind.K_SOURCE; } diff --git a/src/views/projectNode.ts b/src/views/projectNode.ts index f48ef75a..2bd341c4 100644 --- a/src/views/projectNode.ts +++ b/src/views/projectNode.ts @@ -54,6 +54,10 @@ export class ProjectNode extends DataNode { return false; } + public getLabel(): string { + return this._nodeData.displayName ?? this._nodeData.name; + } + protected async loadData(): Promise { return Jdtls.getPackageData({ kind: NodeKind.Project, projectUri: this.nodeData.uri }); } diff --git a/src/views/workspaceNode.ts b/src/views/workspaceNode.ts index 4cb8331f..6cbd1913 100644 --- a/src/views/workspaceNode.ts +++ b/src/views/workspaceNode.ts @@ -14,6 +14,10 @@ export class WorkspaceNode extends DataNode { super(nodeData, parent); } + public getLabel(): string { + return this._nodeData.displayName ?? this._nodeData.name; + } + protected async loadData(): Promise { if (!this.nodeData.uri) { return undefined;