diff --git a/package.json b/package.json index c3b0ff85..2135aa3d 100644 --- a/package.json +++ b/package.json @@ -366,6 +366,11 @@ "when": "view == mavenProjects && viewItem == MavenProject", "group": "inline" }, + { + "command": "maven.project.openPom", + "when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+maven\\b)(?=.*?\\b\\+uri\\b)/", + "group": "inline" + }, { "command": "maven.plugin.execute", "when": "view == mavenProjects && viewItem == PluginGoal", diff --git a/src/extension.ts b/src/extension.ts index c4a8fe0c..81664f66 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. "use strict"; +import * as path from "path"; import * as vscode from "vscode"; import { Progress, Uri } from "vscode"; import { dispose as disposeTelemetryWrapper, initialize, instrumentOperation, sendInfo } from "vscode-extension-telemetry-wrapper"; @@ -205,8 +206,16 @@ async function refreshExplorerHandler(item?: ITreeItem): Promise { } } -async function openPomHandler(node: MavenProject): Promise { - if (node !== undefined && node.pomPath) { - await openFileIfExists(node.pomPath); +async function openPomHandler(node: MavenProject | {uri: string}): Promise { + if (node instanceof MavenProject) { + if (node.pomPath) { + await openFileIfExists(node.pomPath); + } + } else { + // for nodes from Project Manager + if (node.uri) { + const pomPath: string = path.join(Uri.parse(node.uri).fsPath, "pom.xml"); + await openFileIfExists(pomPath); + } } }