|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.fr.start; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.function.UITerminator; |
|
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
import com.fr.design.actions.file.WebPreviewUtils; |
|
|
|
@ -65,9 +66,9 @@ import com.fr.stable.StableUtils;
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.lifecycle.FineLifecycleFatalError; |
|
|
|
|
import com.fr.stable.xml.XMLTools; |
|
|
|
|
import com.fr.start.common.DesignerStartupContext; |
|
|
|
|
import com.fr.start.common.SplashCommon; |
|
|
|
|
import com.fr.start.module.StartupArgs; |
|
|
|
|
import com.fr.start.common.DesignerStartupContext; |
|
|
|
|
import com.fr.start.preload.PreLoadService; |
|
|
|
|
import com.fr.start.server.ServerTray; |
|
|
|
|
import com.fr.third.org.apache.commons.lang3.time.StopWatch; |
|
|
|
@ -88,8 +89,6 @@ import java.awt.event.ActionListener;
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
import java.util.concurrent.ForkJoinPool; |
|
|
|
|
import java.util.concurrent.ForkJoinTask; |
|
|
|
|
import java.util.concurrent.LinkedBlockingQueue; |
|
|
|
|
import java.util.concurrent.ThreadFactory; |
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor; |
|
|
|
@ -123,7 +122,7 @@ public class MainDesigner extends BaseDesigner {
|
|
|
|
|
|
|
|
|
|
DesignerStartupContext.getRecorder().start(); |
|
|
|
|
|
|
|
|
|
startPreload(); |
|
|
|
|
startPreload0(); |
|
|
|
|
|
|
|
|
|
DeepLinkManager.getInstance().start(args); |
|
|
|
|
StopWatch watch = new StopWatch(); |
|
|
|
@ -131,6 +130,9 @@ public class MainDesigner extends BaseDesigner {
|
|
|
|
|
DesignerLifecycleMonitorContext.getMonitor().beforeStart(); |
|
|
|
|
//启动运行时
|
|
|
|
|
FineRuntime.start(); |
|
|
|
|
|
|
|
|
|
startPreload1(); |
|
|
|
|
|
|
|
|
|
DesignerSubListener.getInstance().start(); |
|
|
|
|
EventDispatcher.listen(LifecycleErrorEvent.SELF, new Listener<FineLifecycleFatalError>() { |
|
|
|
|
@Override |
|
|
|
@ -157,13 +159,31 @@ public class MainDesigner extends BaseDesigner {
|
|
|
|
|
watch.stop(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void startPreload() { |
|
|
|
|
/** |
|
|
|
|
* 在 {@link FineRuntime#start()} 运行后 |
|
|
|
|
*/ |
|
|
|
|
private static void startPreload1() { |
|
|
|
|
|
|
|
|
|
CompletableFuture<Void> initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel); |
|
|
|
|
PreLoadService.getInstance().addFuture(initLookAndFeel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在 {@link FineRuntime#start()} 运行前 |
|
|
|
|
*/ |
|
|
|
|
private static void startPreload0() { |
|
|
|
|
|
|
|
|
|
PreLoadService.getInstance().addRunnable(() -> { |
|
|
|
|
if (DesignUtils.isPortOccupied()) { |
|
|
|
|
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.PORT_OCCUPIED.getId(), |
|
|
|
|
DesignerErrorMessage.PORT_OCCUPIED.getMessage()); |
|
|
|
|
DesignerPort.getInstance().resetPort(); |
|
|
|
|
UITerminator action = new UITerminator() { |
|
|
|
|
@Override |
|
|
|
|
protected void doRun() { |
|
|
|
|
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.PORT_OCCUPIED.getId(), |
|
|
|
|
DesignerErrorMessage.PORT_OCCUPIED.getMessage()); |
|
|
|
|
DesignerPort.getInstance().resetPort(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
action.run(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -171,13 +191,13 @@ public class MainDesigner extends BaseDesigner {
|
|
|
|
|
Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); |
|
|
|
|
}; |
|
|
|
|
PreLoadService.getInstance().addRunnable(fontLoad); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CompletableFuture<Void> splashFuture = CompletableFuture.runAsync(() -> { |
|
|
|
|
DesignerEnvManager.getEnvManager(false); |
|
|
|
|
}) |
|
|
|
|
.thenRunAsync(DesignUtils::initLookAndFeel) |
|
|
|
|
.thenRun(MainDesigner::showSplash); |
|
|
|
|
PreLoadService.getInstance().addFuture(splashFuture); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void showSplash() { |
|
|
|
|