Browse Source

KERNEL-1117 根据要求再次修改

pull/11/head
Kalven 5 years ago
parent
commit
93f40eb101
  1. 18
      src/main/java/com/fanruan/api/function/FunctionKit.java
  2. 15
      src/main/java/com/fanruan/api/macro/OperatingSystem.java

18
src/main/java/com/fanruan/api/function/FunctionKit.java

@ -1,8 +1,12 @@
package com.fanruan.api.function; package com.fanruan.api.function;
import com.fanruan.api.function.shell.FineFunc; 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.FunctionManager;
import com.fr.file.FunctionManagerProvider;
import com.fr.script.Calculator; import com.fr.script.Calculator;
//import com.fr.solution.plugin.design.formula.compat.FunctionDefNAD;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.script.FunctionDef; 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 函数管理器 * @return 函数管理器

15
src/main/java/com/fanruan/api/macro/OperatingSystem.java

@ -10,20 +10,35 @@ import com.fr.stable.os.AbstractOperatingSystem;
*/ */
public class OperatingSystem { public class OperatingSystem {
/**
* 得到当前操作系统信息
*/
private static final AbstractOperatingSystem myOS = com.fr.stable.os.OperatingSystem.getOperatingSystem(); private static final AbstractOperatingSystem myOS = com.fr.stable.os.OperatingSystem.getOperatingSystem();
private OperatingSystem() { private OperatingSystem() {
} }
/**
* 判断系统是否是Windows
* @return 判断结果
*/
public static boolean isWindows() { public static boolean isWindows() {
return myOS.getType() == com.fr.stable.os.OperatingSystem.WINDOWS; return myOS.getType() == com.fr.stable.os.OperatingSystem.WINDOWS;
} }
/**
* 判断系统是否是Unix
* @return 判断结果
*/
public static boolean isUnix() { public static boolean isUnix() {
return myOS.isUnix(); return myOS.isUnix();
} }
/**
* 判断系统是否是MacOS
* @return 判断结果
*/
public static boolean isMacOS() { public static boolean isMacOS() {
return myOS.getType() == com.fr.stable.os.OperatingSystem.MACOS; return myOS.getType() == com.fr.stable.os.OperatingSystem.MACOS;
} }

Loading…
Cancel
Save