Browse Source

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

This reverts commit 6694648b91.
release/11.0
Destiny.Lin 1 year ago
parent
commit
3258151e7d
  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,7 +2,6 @@ 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;
@ -15,7 +14,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.ListenerAdaptor;
import com.fr.event.Listener;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
@ -24,6 +23,9 @@ 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;
@ -76,9 +78,9 @@ public class VcsHelper implements JTemplateActionListener {
if (op != null) {
legacyMode = op.isLegacyMode();
}
EventDispatcher.listen(ConfigEvent.READY, new ListenerAdaptor() {
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
protected void on(Event event) {
public void on(Event event, Workspace param) {
legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode();
}
});
@ -251,15 +253,6 @@ public class VcsHelper implements JTemplateActionListener {
return legacyMode;
}
/**
* 更新当前的legacyMode状态
* <li>目前用在迁移结束后更新模式为新模式</li>
*
*/
public void updateLegacyMode() {
this.legacyMode = !legacyMode;
}
@Override
public void templateOpened(JTemplate<?, ?> jt) {
try {
@ -299,9 +292,7 @@ public class VcsHelper implements JTemplateActionListener {
}
}
});
if (!fireVcs.isShutdown()) {
fireVcs.shutdown();
}
fireVcs.shutdown();
}
private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) {
@ -361,7 +352,7 @@ public class VcsHelper implements JTemplateActionListener {
* @return 支持返回true
*/
public boolean checkV2FunctionSupport() {
return !VcsHelper.getInstance().isLegacyMode() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot());
return VcsConfig.getInstance().isUseV2() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot());
}
/**
@ -370,6 +361,6 @@ public class VcsHelper implements JTemplateActionListener {
* @return 支持返回true
*/
public boolean checkMoveFunctionSupport() {
return VcsHelper.getInstance().isLegacyMode() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot());
return !VcsConfig.getInstance().isUseV2() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot());
}
}

1
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovePanel.java

@ -372,7 +372,6 @@ public class VcsMovePanel extends BasicPane {
}
});
VcsManager.getInstance().updateManager();
VcsHelper.getInstance().updateLegacyMode();
}
}

Loading…
Cancel
Save