From 4868bef9ade7ec513543606d70d5499c6e4fb94e Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Jul 2023 10:53:18 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"REPORT-91839=20=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86=E4=BA=8C=E6=9C=9F?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=88=A4=E6=96=AD=E6=96=B0=E8=80=81?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=93=8D=E5=BA=94=E6=94=B9=E4=B8=BAConfig=E5=87=86?= =?UTF-8?q?=E5=A4=87=E5=90=8E=E8=BF=9B=E8=A1=8C""?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3258151e7df95826391ac0b854aac323f79b4139. --- .../mainframe/vcs/common/VcsHelper.java | 27 ++++++++++++------- .../design/mainframe/vcs/ui/VcsMovePanel.java | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java index ce7f4094b9..1c81481bb9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.common; import com.fr.concurrent.NamedThreadFactory; +import com.fr.config.ConfigEvent; import com.fr.design.DesignerEnvManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; @@ -14,7 +15,7 @@ import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.ui.FileVersionTable; import com.fr.event.Event; import com.fr.event.EventDispatcher; -import com.fr.event.Listener; +import com.fr.event.ListenerAdaptor; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; @@ -23,9 +24,6 @@ import com.fr.report.entity.VcsEntity; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import com.fr.workspace.Workspace; -import com.fr.workspace.WorkspaceEvent; -import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; import com.fr.workspace.server.vcs.git.config.GcConfig; @@ -78,9 +76,9 @@ public class VcsHelper implements JTemplateActionListener { if (op != null) { legacyMode = op.isLegacyMode(); } - EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { + EventDispatcher.listen(ConfigEvent.READY, new ListenerAdaptor() { @Override - public void on(Event event, Workspace param) { + protected void on(Event event) { legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); } }); @@ -253,6 +251,15 @@ public class VcsHelper implements JTemplateActionListener { return legacyMode; } + /** + * 更新当前的legacyMode状态 + *
  • 目前用在迁移结束后更新模式为新模式
  • + * + */ + public void updateLegacyMode() { + this.legacyMode = !legacyMode; + } + @Override public void templateOpened(JTemplate jt) { try { @@ -292,7 +299,9 @@ public class VcsHelper implements JTemplateActionListener { } } }); - fireVcs.shutdown(); + if (!fireVcs.isShutdown()) { + fireVcs.shutdown(); + } } private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) { @@ -352,7 +361,7 @@ public class VcsHelper implements JTemplateActionListener { * @return 支持返回true */ public boolean checkV2FunctionSupport() { - return VcsConfig.getInstance().isUseV2() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot()); + return !VcsHelper.getInstance().isLegacyMode() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot()); } /** @@ -361,6 +370,6 @@ public class VcsHelper implements JTemplateActionListener { * @return 支持返回true */ public boolean checkMoveFunctionSupport() { - return !VcsConfig.getInstance().isUseV2() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot()); + return VcsHelper.getInstance().isLegacyMode() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java index 350d20424e..9a3235cd15 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java @@ -372,6 +372,7 @@ public class VcsMovePanel extends BasicPane { } }); VcsManager.getInstance().updateManager(); + VcsHelper.getInstance().updateLegacyMode(); } }