From b45cfc65f0a5ee58c030452a821feba38a6d6151 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 31 May 2022 14:43:58 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-72097=20=E8=A1=A8=E6=A0=BC=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=80=89=E4=B8=AD=E5=90=8E=E4=BC=9A=E5=8F=98=E6=88=90?= =?UTF-8?q?=E9=BB=91=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cell/settingpane/CellOtherSetPane.java | 51 ++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index eeaf8f920f..742629af01 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -421,25 +421,37 @@ public class CellOtherSetPane extends AbstractCellAttrPane { @Override public void itemStateChanged(ItemEvent e) { - Style elementStyle = cellElement.getStyle(); - FRFont frFont = elementStyle.getFRFont(); - if (showContent.getSelectedIndex() == 3) { - fileNamePane.setPreferredSize(new Dimension(100, 20)); - fileNameLayout.show(fileNamePane, "content"); - frFont = frFont.applyForeground(Color.blue); - frFont = frFont.applyUnderline(Constants.LINE_THIN); - } else { - fileNameLayout.show(fileNamePane, "none"); - fileNamePane.setPreferredSize(new Dimension(0, 0)); - frFont = frFont.applyForeground(Color.black); - frFont = frFont.applyUnderline(Constants.LINE_NONE); + if (e.getStateChange() == ItemEvent.SELECTED) { + if (showContent.getSelectedIndex() == 3) { + fileNamePane.setPreferredSize(new Dimension(100, 20)); + fileNameLayout.show(fileNamePane, "content"); + } else { + fileNameLayout.show(fileNamePane, "none"); + fileNamePane.setPreferredSize(new Dimension(0, 0)); + } + handleCellShowStyleChange(e); } - cellElement.setStyle(elementStyle.deriveFRFont(frFont)); } }); return fileNamePane; } + private void handleCellShowStyleChange(ItemEvent itemEvent) { + CellGUIAttr cellGUIAttr = getCellGUIAttr(); + int selectedIndex = showContent.getSelectedIndex(); + boolean showAsDownload = cellGUIAttr.isShowAsDownload(); + Style elementStyle = cellElement.getStyle(); + FRFont frFont = elementStyle.getFRFont(); + if (!showAsDownload && selectedIndex == 3) { + frFont = frFont.applyForeground(Color.blue); + frFont = frFont.applyUnderline(Constants.LINE_THIN); + } else if (showAsDownload && selectedIndex != 3) { + frFont = frFont.applyForeground(Color.black); + frFont = frFont.applyUnderline(Constants.LINE_NONE); + } + cellElement.setStyle(elementStyle.deriveFRFont(frFont)); + } + private void initAllNames() { defaultAutoRadioButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Follow_Paper_Settings")); @@ -475,15 +487,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Other"); } + private CellGUIAttr getCellGUIAttr() { + CellGUIAttr cellGUIAttr = cellElement.getCellGUIAttr(); + if (cellGUIAttr == null) { + cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; + } + return cellGUIAttr; + } + @Override protected void populateBean() { this.currentPageFixedRowDataTipLabel.setText(" (" + Toolkit.i18nText("Fine-Design_Report_CellWrite_No_Page_Fixed_Row_Cell") + ")"); this.pageFixedRowDataCell = null; checkPageFixedRow(); - CellGUIAttr cellGUIAttr = cellElement.getCellGUIAttr(); - if (cellGUIAttr == null) { - cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; - } + CellGUIAttr cellGUIAttr = getCellGUIAttr(); // 支持 跟随页面设置 选项 = 不在编辑表单中的报表块 && 不在大屏模板cpt组件中 boolean supportFollowTplDefine = !EastRegionContainerPane.getInstance().getCurrentMode().equals(EastRegionContainerPane.PropertyMode.FORM_REPORT) From f4b28447f43ff9b14c68a0c045560d268dea8a79 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 1 Jun 2022 15:10:33 +0800 Subject: [PATCH 2/6] =?UTF-8?q?REPORT-72252=20LocalResourceProvider?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=9C=A811=E7=89=88=E6=9C=AC=E4=B8=8A?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/start/module/PreStartActivator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index 65cdc1c30d..fa795fb372 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -2,6 +2,7 @@ package com.fr.start.module; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; +import com.fr.design.file.TemplateResourceManager; import com.fr.design.utils.DesignUtils; import com.fr.file.TmpFileUtils; import com.fr.general.CloudCenter; @@ -28,6 +29,9 @@ public class PreStartActivator extends Activator { // 创建监听服务 DesignUtils.createListeningServer(DesignUtils.getPort(), startFileSuffix()); + // 在插件引擎模块起来前 初始化下插件接口监听 + TemplateResourceManager.getResource(); + initLanguage(); } From 09c7d6c6c414d0850ad2d58d6e226b005a8bb795 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 1 Jun 2022 18:23:20 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-72831=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=AD=A3=E5=B8=B8=E7=9A=84=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E4=BA=86=201-=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=86=99?= =?UTF-8?q?=E5=8F=8D=E4=BA=86=202-=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AA=20A?= =?UTF-8?q?ctivator=20=E7=9A=84=E5=90=8D=E5=AD=97=E5=92=8C=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E9=A1=B9=203-=E4=BF=AE=E6=94=B9=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=9A=84=E6=97=B6=E5=80=99=E7=9A=84=20UI=20?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=204-=E4=BF=AE=E5=A4=8D=E5=B0=8F=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=87=AA=E5=B7=B1=E5=8F=91=E7=8E=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/env/{detect => }/EnvPrepare.java | 3 ++- .../com/fr/env/detect/EnvDetectorCenter.java | 23 +++++++++++++++---- .../fr/env/detect/base/DetectorBridge.java | 5 ++++ .../fr/env/detect/impl/JarLackDetector.java | 3 ++- .../converter/ClassConflictConvertor.java | 9 ++++++-- .../fr/env/detect/ui/EnvDetectorDialog.java | 15 +++++++++++- 6 files changed, 48 insertions(+), 10 deletions(-) rename designer-base/src/main/java/com/fr/env/{detect => }/EnvPrepare.java (89%) diff --git a/designer-base/src/main/java/com/fr/env/detect/EnvPrepare.java b/designer-base/src/main/java/com/fr/env/EnvPrepare.java similarity index 89% rename from designer-base/src/main/java/com/fr/env/detect/EnvPrepare.java rename to designer-base/src/main/java/com/fr/env/EnvPrepare.java index 258d579aaa..999088e272 100644 --- a/designer-base/src/main/java/com/fr/env/detect/EnvPrepare.java +++ b/designer-base/src/main/java/com/fr/env/EnvPrepare.java @@ -1,5 +1,6 @@ -package com.fr.env.detect; +package com.fr.env; +import com.fr.env.detect.EnvDetectorCenter; import com.fr.module.Activator; /** diff --git a/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java b/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java index 98938a4f8e..e9ed96cf8d 100644 --- a/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java +++ b/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.ui.util.UIUtil; import com.fr.env.detect.base.DetectorBridge; import com.fr.env.detect.base.DetectorUtil; +import com.fr.env.detect.base.EnvDetectorConfig; import com.fr.env.detect.bean.DetectorResult; import com.fr.env.detect.bean.DetectorStatus; import com.fr.event.Event; @@ -50,6 +51,14 @@ public class EnvDetectorCenter { * 初始化 */ public void init() { + + // 重置逻辑 + DetectorBridge.getInstance().reset(); + + // 如果已经启动了,则不再启动 + if (PROCESS.get() != null) { + return; + } // 默认是启动 PROCESS.set(DetectorProcess.DESIGN_LAUNCH); @@ -121,13 +130,17 @@ public class EnvDetectorCenter { */ public void stop() { - // 一分钟后执行 + // 结束 + DetectorBridge.getInstance().stop(); + + // 30s后执行 DelayHelper.delayCall(EnvDetectorCenter.class.getName(), () -> { - + + // 如果当前没开启,则直接返回 + if (!EnvDetectorConfig.getInstance().isEnabled()) { + return; + } Stream resultStream = DetectorBridge.getInstance().detect(); - - // 结束 - DetectorBridge.getInstance().stop(); // 展示效果 NotificationDialogProperties properties = new NotificationDialogProperties(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Detect_Notification_Title")); diff --git a/designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java b/designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java index 0d5b60bc09..50bca7fd1c 100644 --- a/designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java +++ b/designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java @@ -71,6 +71,11 @@ public class DetectorBridge { } } + public void reset() { + + ThrowableStore.getInstance().reset(); + } + /** * 针对某一项进行检测 * 主要用于手动检测时 diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java index 74c908000a..8c85da202e 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java @@ -78,7 +78,8 @@ public class JarLackDetector extends AbstractExceptionDetector { } private boolean isLackInfo(BuildInfo e) { - return StringUtils.isNotEmpty(e.getGroupBuild()); + + return StringUtils.isEmpty(e.getGroupBuild()); } private Message tipsMessage(List infos) { diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java b/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java index 3432d976d7..ab2b16ed9a 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/converter/ClassConflictConvertor.java @@ -110,13 +110,18 @@ public class ClassConflictConvertor implements ThrowableConverter { } } + // 如果少于两个,则不需要提示 + if (allPath.size() < 2) { + return null; + } + String msg = StringUtils.join(allPath, SEPARATOR); DetectorType type = DetectorType.JAR_CONFLICT; return DetectorResult.exception(type, - ExceptionTips.create(Toolkit.i18nText(type.getTipsLocale(), msg)), + ExceptionTips.create(Toolkit.i18nText(type.getTipsLocale()) + msg), ExceptionSolution.create(Toolkit.i18nText(type.getSolutionLocale()), DetectorConstants.JAR_HELP_LINK, null), - ExceptionLog.create(Toolkit.i18nText(type.getLogLocale()), msg)); + ExceptionLog.create(Toolkit.i18nText(type.getLogLocale()) + msg)); } @NotNull diff --git a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java index 64d6f41682..96120e317f 100644 --- a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java +++ b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java @@ -166,7 +166,11 @@ public class EnvDetectorDialog extends JDialog { } private void startDetecting(UIButton detectButton) { - + + // 重新检测的时候需要处理一些逻辑 + if (buttonStatus == EnvDetectorButtonStatus.A_NEW) { + reInit(); + } // 执行前 buttonStatus = buttonStatus.next(); UIUtil.invokeLaterIfNeeded(() -> detectButton.setText(buttonStatus.getDesc())); @@ -222,6 +226,15 @@ public class EnvDetectorDialog extends JDialog { detectWorker.execute(); } + private void reInit() { + currentDetectIndex = 0; + for (EnvDetectorItem e : model.getItems()) { + e.setResult(null); + } + // 刷新一下面板-开始执行啦 + UIUtil.invokeLaterIfNeeded(EnvDetectorDialog.this::refresh); + } + private void stopDetecting(UIButton detectButton) { buttonStatus = buttonStatus.next(); From 16eea506d74a530781979852aff0ce699f124014 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 2 Jun 2022 09:24:49 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-72831=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=AD=A3=E5=B8=B8=E7=9A=84=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E4=BA=86=20=E9=81=97?= =?UTF-8?q?=E6=BC=8F=E4=B8=80=E9=83=A8=E5=88=86=EF=BC=8C=E5=90=88=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/env/detect/impl/JarInconsistentDetector.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java b/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java index 679671997b..b13195067b 100644 --- a/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java +++ b/designer-base/src/main/java/com/fr/env/detect/impl/JarInconsistentDetector.java @@ -54,7 +54,6 @@ public class JarInconsistentDetector extends AbstractExceptionDetector { if (WorkContext.getCurrent().isLocal()) { return detectLocal(); - } else { return detectLocalAndRemote(); } @@ -75,13 +74,14 @@ public class JarInconsistentDetector extends AbstractExceptionDetector { Map remoteMap = groupBy(remoteInfos); MapDifference difference = Maps.difference(localMap, remoteMap); - Map diffInCommon = difference.entriesInCommon(); + // 获取本地远程不一样的部分 + Map> diffs = difference.entriesDiffering(); - if (diffInCommon.isEmpty()) { + if (diffs.isEmpty()) { return DetectorResult.normal(type()); } - Set inConsistentJars = diffInCommon.keySet(); + Set inConsistentJars = diffs.keySet(); String message = StringUtils.join(inConsistentJars, SEPARATOR); Message.Simple tipsMessage = new Message.Simple(Toolkit.i18nText("Fine_Design_Basic_Detect_Server") + Toolkit.i18nText(type().getTipsLocale()) + message); From 1a1b76e6ec98eac0e56ccbba9908a80571858f60 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 2 Jun 2022 12:49:30 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-72831=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A3=80=E6=B5=8B-=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=AD=A3=E5=B8=B8=E7=9A=84=EF=BC=8C=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E6=8A=9B=E5=87=BA=E5=BC=82=E5=B8=B8=E4=BA=86=20=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=BF=99=E9=83=A8=E5=88=86=E6=9C=89=E4=BA=9B=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82=20core.xml=20=E9=87=8C=E9=9D=A2=E7=9A=84=20l?= =?UTF-8?q?og=20=E5=8A=A0=E8=BD=BD=E5=90=8E=EF=BC=8C=E4=BC=9A=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E8=BF=99=E9=87=8C=E7=9A=84=20log=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E3=80=82=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E3=80=82=E6=8F=90=E4=BE=9B=E9=BB=98=E8=AE=A4=E7=9A=84?= =?UTF-8?q?=20appender?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/env/EnvPrepare.java | 2 +- .../com/fr/env/detect/EnvDetectorCenter.java | 121 +++++++++++------- .../detect/thowable/ThrowableLogAppender.java | 8 +- 3 files changed, 82 insertions(+), 49 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/EnvPrepare.java b/designer-base/src/main/java/com/fr/env/EnvPrepare.java index 999088e272..288d2f09c6 100644 --- a/designer-base/src/main/java/com/fr/env/EnvPrepare.java +++ b/designer-base/src/main/java/com/fr/env/EnvPrepare.java @@ -22,6 +22,6 @@ public class EnvPrepare extends Activator { @Override public void stop() { - + EnvDetectorCenter.getInstance().destroy(); } } diff --git a/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java b/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java index e9ed96cf8d..070d63d850 100644 --- a/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java +++ b/designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java @@ -37,6 +37,43 @@ import java.util.stream.Stream; **/ public class EnvDetectorCenter { + private final Listener AFTER_START_LISTENER = new Listener() { + @Override + public void on(Event event, Null param) { + if (isSameProcess(DetectorProcess.SERVER_LAUNCH)) { + stop(); + } + } + }; + private final Listener BEFORE_START_LISTENER = new Listener() { + @Override + public void on(Event event, Null param) { + PROCESS.set(DetectorProcess.SERVER_LAUNCH); + start(); + } + }; + + + private final Listener START_UP_COMPLETE_LISTENER = new Listener() { + + @Override + public void on(Event event, Null param) { + if (isSameProcess(DetectorProcess.DESIGN_LAUNCH)) { + stop(); + } + } + }; + private final Listener AFTER_SWITCH_LISTENER = new Listener() { + @Override + public void on(Event event, Workspace param) { + if (isSameProcess(DetectorProcess.DESIGN_LAUNCH)) { + stop(); + } + } + }; + + private final AtomicReference PROCESS = new AtomicReference<>(); + public static EnvDetectorCenter getInstance() { return EnvDetectorCenterHolder.INSTANCE; } @@ -45,62 +82,36 @@ public class EnvDetectorCenter { private static final EnvDetectorCenter INSTANCE = new EnvDetectorCenter(); } - private final AtomicReference PROCESS = new AtomicReference<>(); - /** * 初始化 */ public void init() { - - // 重置逻辑 - DetectorBridge.getInstance().reset(); // 如果已经启动了,则不再启动 if (PROCESS.get() != null) { return; } - + + start(); // 默认是启动 PROCESS.set(DetectorProcess.DESIGN_LAUNCH); - start(); - - // 添加启动完成监听 - EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { - @Override - public void on(Event event, Null param) { - if (isSameProcess(DetectorProcess.DESIGN_LAUNCH)) { - stop(); - } - } - }); - - // 切换完成后的监听 - EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { - @Override - public void on(Event event, Workspace param) { - if (isSameProcess(DetectorProcess.DESIGN_LAUNCH)) { - stop(); - } - } - }); - - // 打开内置服务器 - EventDispatcher.listen(EmbedServerEvent.BeforeStart, new Listener() { - @Override - public void on(Event event, Null param) { - PROCESS.set(DetectorProcess.SERVER_LAUNCH); - start(); - } - }); - EventDispatcher.listen(EmbedServerEvent.AfterStart, new Listener() { - @Override - public void on(Event event, Null param) { - if (isSameProcess(DetectorProcess.SERVER_LAUNCH)) { - stop(); - } - } - }); + + listen(); + } + + + /** + * 销毁,一般用在模块关闭中 + */ + public void destroy() { + + stopListen(); + // 重置内容 + DetectorBridge.getInstance().reset(); + // 关闭逻辑 + DetectorBridge.getInstance().stop(); + PROCESS.set(null); } /** @@ -175,6 +186,28 @@ public class EnvDetectorCenter { .collect(Collectors.toList()); } + + private void listen() { + + // 添加启动完成监听 + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, START_UP_COMPLETE_LISTENER); + + // 切换完成后的监听 + EventDispatcher.listen(WorkspaceEvent.AfterSwitch, AFTER_SWITCH_LISTENER); + + // 内置服务器监听 + EventDispatcher.listen(EmbedServerEvent.BeforeStart, BEFORE_START_LISTENER); + EventDispatcher.listen(EmbedServerEvent.AfterStart, AFTER_START_LISTENER); + } + + private void stopListen() { + + EventDispatcher.stopListen(START_UP_COMPLETE_LISTENER); + EventDispatcher.stopListen(AFTER_SWITCH_LISTENER); + EventDispatcher.stopListen(BEFORE_START_LISTENER); + EventDispatcher.stopListen(AFTER_START_LISTENER); + } + private enum DetectorProcess { /** diff --git a/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java b/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java index 14210b8fb2..5b471f337e 100644 --- a/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java +++ b/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java @@ -1,6 +1,6 @@ package com.fr.env.detect.thowable; -import com.fr.log.FineLoggerFactory; +import com.fr.general.FRLogger; import com.fr.log.LogHandler; import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.core.Filter; @@ -57,11 +57,11 @@ public class ThrowableLogAppender extends AbstractAppender { public void enable() { - FineLoggerFactory.getLogger().addLogAppender(logHandler); + FRLogger.getLogger().addExtendLogAppender(logHandler); } public void disable() { - - FineLoggerFactory.getLogger().removeLogAppender(logHandler); + + FRLogger.getLogger().removeExtendLogAppender(logHandler); } } From 0989763254d90c5d96d16fd1dc4825e9191e9dac Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 2 Jun 2022 14:17:19 +0800 Subject: [PATCH 6/6] =?UTF-8?q?catch=20=E4=BD=8F=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E8=BF=99=E4=B8=80=E5=9D=97=E6=AD=BB?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../env/detect/thowable/ThrowableLogAppender.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java b/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java index 5b471f337e..bcb4736e1d 100644 --- a/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java +++ b/designer-base/src/main/java/com/fr/env/detect/thowable/ThrowableLogAppender.java @@ -32,12 +32,15 @@ public class ThrowableLogAppender extends AbstractAppender { @Override public void append(LogEvent logEvent) { - - if (logEvent.getLevel() == Level.ERROR) { - Throwable thrown = logEvent.getThrown(); - if (thrown != null) { - ThrowableStore.getInstance().add(thrown); + + try { + if (logEvent.getLevel() == Level.ERROR) { + Throwable thrown = logEvent.getThrown(); + if (thrown != null) { + ThrowableStore.getInstance().add(thrown); + } } + } catch (Throwable ignore) { } }