Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ tasks.register('devClient', JavaExec) {
'--add-opens=java.base/sun.security.pkcs=ALL-UNNAMED',
'--add-opens=java.base/sun.security.rsa=ALL-UNNAMED',
'--add-opens=java.base/sun.security.x509=ALL-UNNAMED',
'--add-opens=java.desktop/com.apple.eawt=ALL-UNNAMED',
'--add-opens=java.desktop/com.apple.eio=ALL-UNNAMED',
'--add-opens=java.desktop/java.awt=ALL-UNNAMED',
'--add-opens=java.desktop/java.awt.color=ALL-UNNAMED',
'--add-opens=java.desktop/java.awt.font=ALL-UNNAMED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package com.mirth.connect.client.ui;

import java.awt.Desktop;
import java.net.URI;
import java.util.Arrays;

/**
Expand Down Expand Up @@ -40,31 +42,17 @@ public class BareBonesBrowserLaunch {
* <code>"https://dna-engine.org/"</code>)
*/
public static void openURL(String url) {
try { // attempt to use Desktop library from JDK 1.6+
Class<?> d = Class.forName("java.awt.Desktop");
d.getDeclaredMethod("browse",
new Class<?>[] { java.net.URI.class }).invoke(
d.getDeclaredMethod("getDesktop").invoke(null),
new Object[] { java.net.URI.create(url) });
} catch (Exception ignore) { // library not available or failed
String osName = System.getProperty("os.name");
try {
Desktop.getDesktop().browse(URI.create(url));
} catch (Exception ignore) { // Desktop not supported or failed, assume Unix or Linux
try {
if (osName.startsWith("Mac OS")) {
Class.forName("com.apple.eio.FileManager").getDeclaredMethod(
"openURL", new Class<?>[] { String.class }).invoke(null,
new Object[] { url });
} else if (osName.startsWith("Windows"))
Runtime.getRuntime().exec(new String[] {
"rundll32", "url.dll,FileProtocolHandler", url });
else { // assume Unix or Linux
String browser = null;
for (String b : browsers)
if (browser == null
&& Runtime.getRuntime().exec(new String[] { "which", b }).getInputStream().read() != -1)
Runtime.getRuntime().exec(new String[] { browser = b, url });
if (browser == null)
throw new Exception(Arrays.toString(browsers));
}
String browser = null;
for (String b : browsers)
if (browser == null
&& Runtime.getRuntime().exec(new String[] { "which", b }).getInputStream().read() != -1)
Runtime.getRuntime().exec(new String[] { browser = b, url });
if (browser == null)
throw new Exception(Arrays.toString(browsers));
Comment thread
tonygermano marked this conversation as resolved.
Resolved
} catch (Exception e) {
PlatformUI.MIRTH_FRAME.alertThrowable(PlatformUI.MIRTH_FRAME, e);
}
Expand Down
17 changes: 14 additions & 3 deletions client/src/main/java/com/mirth/connect/client/ui/Mirth.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,20 @@ public static void initUIManager() {
createAlternateKeyBindings();
}

if (SystemUtils.IS_OS_MAC) {
OSXAdapter.setAboutHandler(Mirth.class, Mirth.class.getDeclaredMethod("aboutMac", (Class[]) null));
OSXAdapter.setQuitHandler(Mirth.class, Mirth.class.getDeclaredMethod("quitMac", (Class[]) null));
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.APP_ABOUT)) {
desktop.setAboutHandler(e -> aboutMac());
}
if (desktop.isSupported(Desktop.Action.APP_QUIT_HANDLER)) {
desktop.setQuitHandler((e, response) -> {
if (quitMac()) {
response.performQuit();
} else {
response.cancelQuit();
}
});
}
}
} catch (Exception e) {
LogManager.getLogger(Mirth.class).error("Error initializing look and feel", e);
Expand Down
302 changes: 0 additions & 302 deletions client/src/main/java/com/mirth/connect/client/ui/OSXAdapter.java

This file was deleted.

Loading
Loading