Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ private List<String> addFaComponents(XMLStreamWriter xml,

xml.writeStartElement("Verb");
xml.writeAttribute("Id", "open");
xml.writeAttribute("Command", "Open");
xml.writeAttribute("Command", "!(loc.ContextMenuCommandLabel)");
xml.writeAttribute("Argument", "\"%1\" %*");
xml.writeAttribute("TargetFile", Id.File.of(fa.launcherPath));
xml.writeEndElement(); // <Verb>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<String Id="ShortcutPromptDlgDesktopShortcutControlLabel">Create desktop shortcut(s)</String>
<String Id="ShortcutPromptDlgStartMenuShortcutControlLabel">Create start menu shortcut(s)</String>
<String Id="InstallDirNotEmptyDlg_Title">[ProductName] Setup</String>
<String Id="ContextMenuCommandLabel">Open with [ProductName]</String>
</WixLocalization>
12 changes: 12 additions & 0 deletions test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,18 @@ PackageTest addHelloAppFileAssociationsVerifier(FileAssociations fa) {
HelloApp.verifyOutputFile(appOutput, expectedArgs,
Collections.emptyMap());
});

if (TKit.isWindows()) {
// Verify context menu label in registry.
String progId = WindowsHelper.queryRegistryValue(
String.format("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\%s", fa.getSuffix()), "");
TKit.assertNotNull(progId, "context menu progId found");
String contextMenuLabel = WindowsHelper.queryRegistryValue(
String.format("HKEY_CLASSES_ROOT\\%s\\shell\\open", progId), "");
TKit.assertNotNull(contextMenuLabel, "context menu label found");
String appName = cmd.getArgumentValue("--name");
TKit.assertTrue(String.format("Open with %s", appName).equals(contextMenuLabel), "context menu label text");
}
});

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private void verifyFileAssociations(boolean exists, String suffix,
private final String name;
}

private static String queryRegistryValue(String keyPath, String valueName) {
static String queryRegistryValue(String keyPath, String valueName) {
var status = Executor.of("reg", "query", keyPath, "/v", valueName)
.saveOutput()
.executeWithoutExitCodeCheck();
Expand Down