Browse Source

REPORT-83197【设计器】启动页性能优化

和 vito 讨论,这里的异步可以直接改成 invokeLater
省心省力, get
feature/x
Harrison 2 years ago
parent
commit
90d09befcc
  1. 9
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

9
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,10 +82,12 @@ public class ActionFactory {
public static void registerAsyncInitCellEditorClass(Class keyClazz, Class<? extends QuickEditor> editorClazz) {
cellEditorClass.put(keyClazz, editorClazz);
CompletableFuture.runAsync(() -> {
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
// 这里直接用 invokeLater 放到 UI 线程中去调用。
// 不阻塞主逻辑的启动
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
try {
QuickEditor quickEditor = editorClazz.newInstance();
cellEditorClass.remove(keyClazz);
@ -97,7 +97,6 @@ public class ActionFactory {
}
}
});
}, DesignerStartupPool.designer());
}
/**

Loading…
Cancel
Save