diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java index 68dbec78c..bf4a5155c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java @@ -1,6 +1,6 @@ package com.fr.design.gui.itree.filetree; -import com.fr.file.filetree.LocalFileNodes; +import com.fr.base.FRContext; import com.fr.file.filetree.FileNode; import java.util.Comparator; @@ -59,13 +59,14 @@ public class FileNodeComparator implements Comparator { private int groupByFileType(FileNode nameNode1, FileNode nameNode2, int i) { - if (i < LocalFileNodes.FILE_TYPE.length) { - if (nameNode1.isFileType(LocalFileNodes.FILE_TYPE[i])) - if (nameNode2.isFileType(LocalFileNodes.FILE_TYPE[i])) + String[] supportTypes = FRContext.getFileNodes().getSupportedTypes(); + if (i < supportTypes.length) { + if (nameNode1.isFileType(supportTypes[i])) + if (nameNode2.isFileType(supportTypes[i])) return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); else return-1; - else if (nameNode2.isFileType(LocalFileNodes.FILE_TYPE[i])) + else if (nameNode2.isFileType(supportTypes[i])) return 1; else{ return groupByFileType(nameNode1, nameNode2, i+1); diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 1e4ec0d65..f3f9c7d28 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -23,7 +23,6 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.filetree.FileNode; -import com.fr.file.filetree.LocalFileNodes; import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.FILEFilter; import com.fr.general.ComparatorUtils; @@ -693,14 +692,9 @@ public class FILEChooserPane extends BasicPane { String appName = ProductConstants.APP_NAME; JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (editing == null || !editing.isChartBook()) { - String[] fileSuffix_local = LocalFileNodes.FILE_TYPE; - EnumSet fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT); + if (type == JFileChooser.OPEN_DIALOG) { - if (WorkContext.getCurrent().isLocal()) { //本地连接 - this.addChooseFILEFilter(new ChooseFileFilter(fileSuffix_local, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); - } else { - this.addChooseFILEFilter(new ChooseFileFilter(fileExtensions, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); - } + this.addChooseFILEFilter(new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); } // ben:filefilter设置初值为cpt过滤