From 90d09befcc10c94a8bd05ca06aef907c79a3f066 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 16 Nov 2022 19:03:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-83197=E3=80=90=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E3=80=91=E5=90=AF=E5=8A=A8=E9=A1=B5=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=92=8C=20vito=20=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=EF=BC=8C=E8=BF=99=E9=87=8C=E7=9A=84=E5=BC=82=E6=AD=A5=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=9B=B4=E6=8E=A5=E6=94=B9=E6=88=90=20invokeLater=20?= =?UTF-8?q?=E7=9C=81=E5=BF=83=E7=9C=81=E5=8A=9B=EF=BC=8C=20get?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/core/ActionFactory.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) 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 e4b8b9ed62..3a8137f9d0 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 @@ -9,7 +9,6 @@ import com.fr.design.selection.QuickEditor; import com.fr.design.ui.util.UIUtil; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import com.fr.start.common.DesignerStartupPool; import javax.swing.Action; import javax.swing.KeyStroke; @@ -20,7 +19,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArraySet; @@ -84,20 +82,21 @@ public class ActionFactory { public static void registerAsyncInitCellEditorClass(Class keyClazz, Class editorClazz) { cellEditorClass.put(keyClazz, editorClazz); - CompletableFuture.runAsync(() -> { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { - @Override - public void run() { - try { - QuickEditor quickEditor = editorClazz.newInstance(); - cellEditorClass.remove(keyClazz); - cellEditor.put(keyClazz, quickEditor); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + // 这里直接用 invokeLater 放到 UI 线程中去调用。 + // 不阻塞主逻辑的启动 + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + + try { + QuickEditor quickEditor = editorClazz.newInstance(); + cellEditorClass.remove(keyClazz); + cellEditor.put(keyClazz, quickEditor); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } - }); - }, DesignerStartupPool.designer()); + } + }); } /**