|
|
@ -2,6 +2,7 @@ package com.fr.design.mainframe.vcs.common; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
|
|
|
|
import com.fr.config.ConfigEvent; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.TemplateTreePane; |
|
|
|
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.design.mainframe.vcs.ui.FileVersionTable; |
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.event.ListenerAdaptor; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.plugin.context.PluginContext; |
|
|
|
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.StringUtils; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
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.VcsOperator; |
|
|
|
import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; |
|
|
|
import com.fr.workspace.server.vcs.filesystem.VcsFileSystem; |
|
|
|
import com.fr.workspace.server.vcs.git.config.GcConfig; |
|
|
|
import com.fr.workspace.server.vcs.git.config.GcConfig; |
|
|
@ -78,9 +76,9 @@ public class VcsHelper implements JTemplateActionListener { |
|
|
|
if (op != null) { |
|
|
|
if (op != null) { |
|
|
|
legacyMode = op.isLegacyMode(); |
|
|
|
legacyMode = op.isLegacyMode(); |
|
|
|
} |
|
|
|
} |
|
|
|
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() { |
|
|
|
EventDispatcher.listen(ConfigEvent.READY, new ListenerAdaptor() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void on(Event event, Workspace param) { |
|
|
|
protected void on(Event event) { |
|
|
|
legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); |
|
|
|
legacyMode = WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -253,6 +251,15 @@ public class VcsHelper implements JTemplateActionListener { |
|
|
|
return legacyMode; |
|
|
|
return legacyMode; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新当前的legacyMode状态 |
|
|
|
|
|
|
|
* <li>目前用在迁移结束后更新模式为新模式</li> |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void updateLegacyMode() { |
|
|
|
|
|
|
|
this.legacyMode = !legacyMode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void templateOpened(JTemplate<?, ?> jt) { |
|
|
|
public void templateOpened(JTemplate<?, ?> jt) { |
|
|
|
try { |
|
|
|
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) { |
|
|
|
private void doSave(JTemplate jt, String fileName, int latestFileVersion, boolean replace, VcsOperator operator) { |
|
|
@ -352,7 +361,7 @@ public class VcsHelper implements JTemplateActionListener { |
|
|
|
* @return 支持返回true |
|
|
|
* @return 支持返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean checkV2FunctionSupport() { |
|
|
|
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 |
|
|
|
* @return 支持返回true |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean checkMoveFunctionSupport() { |
|
|
|
public boolean checkMoveFunctionSupport() { |
|
|
|
return !VcsConfig.getInstance().isUseV2() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot()); |
|
|
|
return VcsHelper.getInstance().isLegacyMode() && (WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|