Browse Source

Merge pull request #761 in DESIGN/design from ~NEIL/design:release/10.0 to release/10.0

* commit 'd7adc527017789d8ea5116cf3cf251b2fcd5e7ee':
  pmd
  REPORT-14667 支持通过插件扩展目录树支持的文件后缀
bugfix/10.0
neil 6 years ago
parent
commit
3416d29e39
  1. 9
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  2. 37
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

9
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -1,6 +1,5 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -11,7 +10,6 @@ import com.fr.file.FileNodeFILE;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.web.ParameterConstants; import com.fr.general.web.ParameterConstants;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.web.AbstractWebletCreator;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.util.Collections; import java.util.Collections;
@ -90,13 +88,6 @@ public final class WebPreviewUtils {
java.util.List<String> parameterNameList = new java.util.ArrayList<String>(); java.util.List<String> parameterNameList = new java.util.ArrayList<String>();
java.util.List<String> parameterValueList = new java.util.ArrayList<String>(); java.util.List<String> parameterValueList = new java.util.ArrayList<String>();
// 暂时屏蔽cptx直接访问
if (path.endsWith(FileExtension.CPTX.getSuffix())) {
path = path.substring(0, path.length() - 1);
parameterNameList.add(AbstractWebletCreator.FORMAT);
parameterValueList.add(AbstractWebletCreator.X);
}
parameterNameList.add(actionType); parameterNameList.add(actionType);
parameterValueList.add(path); parameterValueList.add(path);
if (map != null) { if (map != null) {

37
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -2,8 +2,10 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.file.NodeAuthProcessor; import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.mainframe.App;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -15,7 +17,9 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/* /*
* 显示Env下的reportlets目录下面的所有cpt文件 * 显示Env下的reportlets目录下面的所有cpt文件
@ -124,9 +128,28 @@ public class TemplateFileTree extends EnvFileTree {
} }
public FileNode[] listFile(String path) { public FileNode[] listFile(String path) {
// 支持插件扩展, 先从env的filter拿, 再从插件拿
Set<FileExtension> supportTypes = createFileExtensionFilter();
return FRContext.getFileNodes().list( return FRContext.getFileNodes().list(
path, path,
new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CHT, FileExtension.XLS, FileExtension.XLSX}); supportTypes.toArray(new FileExtension[supportTypes.size()])
);
}
private Set<FileExtension> createFileExtensionFilter() {
Set<FileExtension> supportTypes = new HashSet<FileExtension>();
if (filter != null) {
for (String temp : filter.getSupportedTypes()) {
supportTypes.add(FileExtension.parse(temp));
}
}
Set<App> apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING);
for (App temp : apps) {
for (String extendsion : temp.defaultExtensions()) {
supportTypes.add(FileExtension.parse(extendsion));
}
}
return supportTypes;
} }
/* /*
@ -205,18 +228,6 @@ public class TemplateFileTree extends EnvFileTree {
if (fileNodes == null) { if (fileNodes == null) {
fileNodes = new FileNode[0]; fileNodes = new FileNode[0];
} }
// 用FileNodeFilter过滤一下
if (filter != null) {
List<FileNode> list = new ArrayList<FileNode>();
for (FileNode fileNode : fileNodes) {
if (filter.accept(fileNode)) {
list.add(fileNode);
}
}
fileNodes = list.toArray(new FileNode[list.size()]);
}
Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
return fileNodes; return fileNodes;

Loading…
Cancel
Save