Browse Source

改一下写法

newui
roger 2 years ago
parent
commit
8d7c05e302
  1. 2
      designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java
  2. 12
      designer-base/src/main/java/com/fr/design/file/FileOperationHelper.java

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

@ -257,7 +257,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
if (node.getUserObject() instanceof FileNode) {
FileNode fileNode = (FileNode) node.getUserObject();
String newTargetFile = FileOperationHelper.getInstance().copyFile(fileNode, targetDir);
if (TemplateResourceManager.getResource().exist(newTargetFile)) {
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