diff --git a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java index 574195470b..f19c962f83 100644 --- a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java +++ b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java @@ -13,12 +13,14 @@ import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import java.lang.reflect.Constructor; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.CopyOnWriteArraySet; /** * 插入单元格元素和插入悬浮元素的一些集合方法 @@ -27,8 +29,8 @@ import java.util.concurrent.ConcurrentMap; * @version 2017年11月17日14点39分 */ public class ActionFactory { - private static LinkedHashSet> actionClasses = new LinkedHashSet<>(); - private static LinkedHashSet> floatActionClasses = new LinkedHashSet<>(); + private static Set> actionClasses = new CopyOnWriteArraySet<>(); + private static Set> floatActionClasses = new CopyOnWriteArraySet<>(); private static Class chartCollectionClass = null; /** * 无需每次实例化的悬浮元素编辑器 @@ -256,14 +258,14 @@ public class ActionFactory { */ public static void registerCellInsertActionClass(Class[] cls) { if (cls != null) { - Collections.addAll(actionClasses, cls); + actionClasses.addAll(Arrays.asList(cls)); } } public static void referCellInsertActionClass(Class[] cls) { if (cls != null) { actionClasses.clear(); - Collections.addAll(actionClasses, cls); + actionClasses.addAll(Arrays.asList(cls)); } } @@ -321,14 +323,14 @@ public class ActionFactory { */ public static void registerFloatInsertActionClass(Class[] cls) { if (cls != null) { - Collections.addAll(floatActionClasses, cls); + floatActionClasses.addAll(Arrays.asList(cls)); } } public static void referFloatInsertActionClass(Class[] cls) { if (cls != null) { floatActionClasses.clear(); - Collections.addAll(floatActionClasses, cls); + floatActionClasses.addAll(Arrays.asList(cls)); } }