Browse Source

Pull request #9896: REPORT-79492 复制多张模板,删除一部分,触发粘贴后没有定位到粘贴的位置

Merge in DESIGN/design from ~ROGER.CHEN/design:release/11.0 to release/11.0

* commit '8d7c05e302f9bc81aee61a75e9d5e594ff5d4503':
  改一下写法
  REPORT-79492 复制多张模板,删除一部分,触发粘贴后没有定位到粘贴的位置
release/11.0
Roger.Chen 2 years ago
parent
commit
14ae999cb4
  1. 7
      designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java
  2. 12
      designer-base/src/main/java/com/fr/design/file/FileOperationHelper.java

7
designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java

@ -215,7 +215,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
WARNING_MESSAGE);
return;
}
doPaste(targetDir, pasteNodes);
doPaste(targetDir, treeNodeList);
}
/**
@ -256,7 +256,10 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
for (ExpandMutableTreeNode node : pasteNodes) {
if (node.getUserObject() instanceof FileNode) {
FileNode fileNode = (FileNode) node.getUserObject();
targetFile = FileOperationHelper.getInstance().copyFile(fileNode, targetDir);
String newTargetFile = FileOperationHelper.getInstance().copyFile(fileNode, targetDir);
if (StringUtils.isNotEmpty(newTargetFile)) {
targetFile = newTargetFile;
}
FineLoggerFactory.getLogger().debug("Template: {} paste to {} success.", fileNode.getEnvPath(), targetDir);
}
}

12
designer-base/src/main/java/com/fr/design/file/FileOperationHelper.java

@ -119,12 +119,20 @@ public class FileOperationHelper {
}
private String copyFile(FileNode sourceFile, String targetDir, boolean withCopyVcs) {
String sourcePath = sourceFile.getEnvPath();
if (!TemplateResourceManager.getResource().exist(sourcePath)) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Source_File_Not_Exist", sourcePath),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE);
return StringUtils.EMPTY;
}
String name = getNoRepeatedName4Paste(targetDir, sourceFile.getName());
String targetFile = StableUtils.pathJoin(targetDir, name);
if (sourceFile.isDirectory()) {
copyDir(sourceFile.getEnvPath(), targetFile, withCopyVcs);
copyDir(sourcePath, targetFile, withCopyVcs);
} else {
copyFile(sourceFile.getEnvPath(), targetFile, withCopyVcs);
copyFile(sourcePath, targetFile, withCopyVcs);
}
return targetFile;
}

Loading…
Cancel
Save