|
|
|
@ -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<? extends QuickEditor> 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()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|