Browse Source

REPORT-91839 模板版本管理二期 优化判断新老模式的逻辑,事件响应改为Config准备后进行

feature/x
Destiny.Lin 1 year ago
parent
commit
6694648b91
  1. 27
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  2. 1
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java

27
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<Workspace>() {
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状态
* <li>目前用在迁移结束后更新模式为新模式</li>
*
*/
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());
}
}

1
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();
}
}

Loading…
Cancel
Save