|
|
@ -6,12 +6,10 @@ import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.menu.MenuKeySet; |
|
|
|
import com.fr.design.menu.MenuKeySet; |
|
|
|
import com.fr.design.selection.QuickEditor; |
|
|
|
import com.fr.design.selection.QuickEditor; |
|
|
|
|
|
|
|
import com.fr.design.ui.util.UIUtil; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.start.common.DesignerStartupPool; |
|
|
|
import com.fr.start.common.DesignerStartupPool; |
|
|
|
import com.fr.third.guava.util.concurrent.FutureCallback; |
|
|
|
|
|
|
|
import com.fr.third.guava.util.concurrent.Futures; |
|
|
|
|
|
|
|
import com.fr.third.guava.util.concurrent.ListenableFutureTask; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.Action; |
|
|
|
import javax.swing.Action; |
|
|
|
import javax.swing.KeyStroke; |
|
|
|
import javax.swing.KeyStroke; |
|
|
@ -22,7 +20,7 @@ import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.concurrent.Callable; |
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentMap; |
|
|
|
import java.util.concurrent.ConcurrentMap; |
|
|
|
import java.util.concurrent.CopyOnWriteArraySet; |
|
|
|
import java.util.concurrent.CopyOnWriteArraySet; |
|
|
@ -86,23 +84,19 @@ public class ActionFactory { |
|
|
|
public static void registerAsyncInitCellEditorClass(Class keyClazz, Class<? extends QuickEditor> editorClazz) { |
|
|
|
public static void registerAsyncInitCellEditorClass(Class keyClazz, Class<? extends QuickEditor> editorClazz) { |
|
|
|
|
|
|
|
|
|
|
|
cellEditorClass.put(keyClazz, editorClazz); |
|
|
|
cellEditorClass.put(keyClazz, editorClazz); |
|
|
|
Callable<QuickEditor> callable = new Callable<QuickEditor>() { |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
|
|
UIUtil.invokeAndWaitIfNeeded(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public QuickEditor call() throws Exception { |
|
|
|
public void run() { |
|
|
|
return editorClazz.newInstance(); |
|
|
|
try { |
|
|
|
} |
|
|
|
QuickEditor quickEditor = editorClazz.newInstance(); |
|
|
|
}; |
|
|
|
|
|
|
|
ListenableFutureTask<QuickEditor> future = ListenableFutureTask.create(callable); |
|
|
|
|
|
|
|
Futures.addCallback(future, new FutureCallback<QuickEditor>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onSuccess(QuickEditor quickEditor) { |
|
|
|
|
|
|
|
cellEditorClass.remove(keyClazz); |
|
|
|
cellEditorClass.remove(keyClazz); |
|
|
|
cellEditor.put(keyClazz, quickEditor); |
|
|
|
cellEditor.put(keyClazz, quickEditor); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onFailure(Throwable throwable) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}, DesignerStartupPool.designer()); |
|
|
|
}, DesignerStartupPool.designer()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|