Browse Source

Merge remote-tracking branch 'origin/release/11.0' into release/11.0

release/11.0
Link.Zhao 2 years ago
parent
commit
2525bdc54b
  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); WARNING_MESSAGE);
return; return;
} }
doPaste(targetDir, pasteNodes); doPaste(targetDir, treeNodeList);
} }
/** /**
@ -256,7 +256,10 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
for (ExpandMutableTreeNode node : pasteNodes) { for (ExpandMutableTreeNode node : pasteNodes) {
if (node.getUserObject() instanceof FileNode) { if (node.getUserObject() instanceof FileNode) {
FileNode fileNode = (FileNode) node.getUserObject(); 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); 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) { 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 name = getNoRepeatedName4Paste(targetDir, sourceFile.getName());
String targetFile = StableUtils.pathJoin(targetDir, name); String targetFile = StableUtils.pathJoin(targetDir, name);
if (sourceFile.isDirectory()) { if (sourceFile.isDirectory()) {
copyDir(sourceFile.getEnvPath(), targetFile, withCopyVcs); copyDir(sourcePath, targetFile, withCopyVcs);
} else { } else {
copyFile(sourceFile.getEnvPath(), targetFile, withCopyVcs); copyFile(sourcePath, targetFile, withCopyVcs);
} }
return targetFile; return targetFile;
} }

Loading…
Cancel
Save