From 93f40eb1011ee25c37a2991a4e83d80d4aa58f08 Mon Sep 17 00:00:00 2001 From: Kalven Date: Mon, 2 Sep 2019 14:32:31 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-1117=20=E6=A0=B9=E6=8D=AE=E8=A6=81?= =?UTF-8?q?=E6=B1=82=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fanruan/api/function/FunctionKit.java | 18 ++++++++++++++++++ .../com/fanruan/api/macro/OperatingSystem.java | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/main/java/com/fanruan/api/function/FunctionKit.java b/src/main/java/com/fanruan/api/function/FunctionKit.java index d43b9e5..fddf03c 100644 --- a/src/main/java/com/fanruan/api/function/FunctionKit.java +++ b/src/main/java/com/fanruan/api/function/FunctionKit.java @@ -1,8 +1,12 @@ package com.fanruan.api.function; import com.fanruan.api.function.shell.FineFunc; +import com.fr.design.formula.FunctionDefNAD; +import com.fr.design.formula.NameAndDescription; import com.fr.file.FunctionManager; +import com.fr.file.FunctionManagerProvider; import com.fr.script.Calculator; +//import com.fr.solution.plugin.design.formula.compat.FunctionDefNAD; import com.fr.stable.StringUtils; import com.fr.stable.script.FunctionDef; @@ -56,6 +60,20 @@ public class FunctionKit { } } + public static NameAndDescription[] getDescription() { + FunctionManagerProvider funtionManager = FunctionKit.getInstance(); + if (funtionManager != null) { + int functionDefCount = funtionManager.getFunctionDefCount(); + FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; + for (int i = 0; i < functionDefCount; i++) { + nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); + } + + return nads; + } + + return new NameAndDescription[0]; + } /** * 得到函数管理器实例 * @return 函数管理器 diff --git a/src/main/java/com/fanruan/api/macro/OperatingSystem.java b/src/main/java/com/fanruan/api/macro/OperatingSystem.java index 485266f..dd2cce1 100644 --- a/src/main/java/com/fanruan/api/macro/OperatingSystem.java +++ b/src/main/java/com/fanruan/api/macro/OperatingSystem.java @@ -10,20 +10,35 @@ import com.fr.stable.os.AbstractOperatingSystem; */ public class OperatingSystem { + /** + * 得到当前操作系统信息 + */ private static final AbstractOperatingSystem myOS = com.fr.stable.os.OperatingSystem.getOperatingSystem(); private OperatingSystem() { } + /** + * 判断系统是否是Windows + * @return 判断结果 + */ public static boolean isWindows() { return myOS.getType() == com.fr.stable.os.OperatingSystem.WINDOWS; } + /** + * 判断系统是否是Unix + * @return 判断结果 + */ public static boolean isUnix() { return myOS.isUnix(); } + /** + * 判断系统是否是MacOS + * @return 判断结果 + */ public static boolean isMacOS() { return myOS.getType() == com.fr.stable.os.OperatingSystem.MACOS; }