|
|
@ -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(() -> { |
|
|
|
@Override |
|
|
|
UIUtil.invokeAndWaitIfNeeded(new Runnable() { |
|
|
|
public QuickEditor call() throws Exception { |
|
|
|
@Override |
|
|
|
return editorClazz.newInstance(); |
|
|
|
public void run() { |
|
|
|
} |
|
|
|
try { |
|
|
|
}; |
|
|
|
QuickEditor quickEditor = editorClazz.newInstance(); |
|
|
|
ListenableFutureTask<QuickEditor> future = ListenableFutureTask.create(callable); |
|
|
|
cellEditorClass.remove(keyClazz); |
|
|
|
Futures.addCallback(future, new FutureCallback<QuickEditor>() { |
|
|
|
cellEditor.put(keyClazz, quickEditor); |
|
|
|
@Override |
|
|
|
} catch (Exception e) { |
|
|
|
public void onSuccess(QuickEditor quickEditor) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
cellEditorClass.remove(keyClazz); |
|
|
|
} |
|
|
|
cellEditor.put(keyClazz, quickEditor); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onFailure(Throwable throwable) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, DesignerStartupPool.designer()); |
|
|
|
}, DesignerStartupPool.designer()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|