Browse Source

Merge pull request #12532 in DESIGN/design from bugfix/11.0 to feature/x

* commit 'ed781a10d362af7660929abd51a9cff7c6cb7b1b':
  REPORT-101590 【版本管理三期】版本中心触发删除模板所有版本的动作,为什么会打开模板
  REPORT-101578 【版本管理三期】删除文件夹失败
  REPORT-101480 【版本管理二期】自动保存后手动保存,版本管理逻辑会乱
  REPORT-101480 【版本管理二期】自动保存后手动保存,版本管理逻辑会乱
feature/x
superman 1 year ago
parent
commit
693a5b1849
  1. 11
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 21
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  4. 1
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java
  5. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

11
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -407,11 +407,12 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (node instanceof FileNode) { if (node instanceof FileNode) {
FileNodeFILE nodeFILE = new FileNodeFILE((FileNode) node); FileNodeFILE nodeFILE = new FileNodeFILE((FileNode) node);
if (nodeFILE.exists()) { if (nodeFILE.exists()) {
try { if (!VcsHelper.getInstance().isLegacyMode()) {
WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), VcsHelper.getInstance().dealWithFilePath(((FileNode) node).getEnvPath())); try {
} catch (Exception e) { WorkContext.getCurrent().get(VcsOperator.class).recycleVersion(VcsHelper.getInstance().getCurrentUsername(), nodeFILE.getPath());
FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName()); } catch (Exception e) {
return false; FineLoggerFactory.getLogger().error("[VcsV2] recycle {} failed", nodeFILE.getName());
}
} }
if (TemplateResourceManager.getResource().delete(nodeFILE)) { if (TemplateResourceManager.getResource().delete(nodeFILE)) {
HistoryTemplateListCache.getInstance().deleteFile(nodeFILE); HistoryTemplateListCache.getInstance().deleteFile(nodeFILE);

7
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -114,6 +114,8 @@ import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -1146,7 +1148,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @param l 模板Listener * @param l 模板Listener
*/ */
public void addJTemplateActionListener(JTemplateActionListener l) { public void addJTemplateActionListener(JTemplateActionListener l) {
this.listenerList.add(JTemplateActionListener.class, l); List<Object> list = Arrays.asList(this.listenerList.getListeners(JTemplateActionListener.class));
if (!list.contains(l)) {
this.listenerList.add(JTemplateActionListener.class, l);
}
} }
/** /**

21
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -27,6 +27,7 @@ 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.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.vcs.VcsFileUtils;
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;
@ -181,27 +182,9 @@ public class VcsHelper implements JTemplateActionListener {
private String getEditingFilename() { private String getEditingFilename() {
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String editingFilePath = jt.getEditingFILE().getPath(); String editingFilePath = jt.getEditingFILE().getPath();
return dealWithFilePath(editingFilePath); return VcsFileUtils.dealWithFilePath(editingFilePath);
} }
/**
* 处理传入的文件名使其符合Vcs规范
*
* @param filePath 文件路径
* @return 处理完的文件
*/
public String dealWithFilePath(String filePath) {
String vcsCacheDir = VcsFileSystem.getInstance().getVcsCacheRelativePath();
if (filePath.startsWith(ProjectConstants.REPORTLETS_NAME)) {
filePath = filePath.replaceFirst(ProjectConstants.REPORTLETS_NAME, StringUtils.EMPTY);
} else if (filePath.startsWith(vcsCacheDir)) {
filePath = filePath.replaceFirst(vcsCacheDir, StringUtils.EMPTY);
}
if (filePath.startsWith(VCS_FILE_SLASH)) {
filePath = filePath.substring(1);
}
return filePath;
}
private boolean needDeleteVersion(VcsEntity entity) { private boolean needDeleteVersion(VcsEntity entity) {
VcsConfigManager configManager = DesignerEnvManager.getEnvManager().getVcsConfigManager(); VcsConfigManager configManager = DesignerEnvManager.getEnvManager().getVcsConfigManager();

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

@ -120,7 +120,6 @@ public class VcsCenterPane extends VcsNewPane {
model.getList().remove(o); model.getList().remove(o);
model.fireTableDataChanged(); model.fireTableDataChanged();
} }
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(getTemplateTruePath(fileName), false)));
} }
} }
}); });

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsNewPane.java

@ -18,6 +18,7 @@ import com.fr.file.filetree.FileNode;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsFileUtils;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.Icon; import javax.swing.Icon;
@ -267,7 +268,7 @@ public class VcsNewPane extends RecyclePane {
@Override @Override
protected List<VcsTableEntity> getTableList() { protected List<VcsTableEntity> getTableList() {
List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsHelper.getInstance().dealWithFilePath(filePath)); List<VcsEntity> entityList = WorkContext.getCurrent().get(VcsOperator.class).getVersions(VcsFileUtils.dealWithFilePath(filePath));
List<VcsTableEntity> tableEntities = new ArrayList<>(); List<VcsTableEntity> tableEntities = new ArrayList<>();
for (VcsEntity entity : entityList) { for (VcsEntity entity : entityList) {
tableEntities.add(new VcsTableEntity(entity)); tableEntities.add(new VcsTableEntity(entity));

Loading…
Cancel
Save