Browse Source

KERNEL-4069 添加注释

persist/11.0
hades 5 years ago
parent
commit
ff753001c4
  1. 6
      designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java

6
designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java

@ -15,6 +15,10 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* com.apple.eawt.Application属于jdk1.8及以下mac jdk特有的api
* 在jdk9中被移除由Desktop.getDesktop().setQuitHandler等jdk9.0引入的新api替代
* 参见 https://stackoverflow.com/questions/38381824/how-can-i-use-apple-com-apple-eawt-functionality-on-java-8
*
* @author hades
* @version 10.0
* Created by hades on 2020/3/13
@ -33,6 +37,8 @@ public class MacOsAddListenerAction implements OSBasedAction {
Reflect.on(application).call("setQuitHandler", quitInstance)
.call("setAboutHandler", aboutInstance);
} catch (ClassNotFoundException e) {
// 上面的不能移除,同时要保证再jdk1.8下面能运行
// 抛出异常时 说明使用>=jdk9运行行设计器,但由于编译使用1.8构建,使用反射运行
try {
Class quitHandler = Class.forName("java.awt.desktop.QuitHandler");
Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction());

Loading…
Cancel
Save