From 6675c853b82799b507df9b4c1364e8f88ba1cd87 Mon Sep 17 00:00:00 2001 From: ju Date: Sat, 29 Sep 2018 16:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=A5=E9=87=8Dfindbugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/itree/filetree/FileNodeComparator.java | 11 ++++++----- .../src/main/java/com/fr/file/FILEChooserPane.java | 10 ++-------- 2 files changed, 8 insertions(+), 13 deletions(-) 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 68dbec78cc..bf4a5155c7 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 1e4ec0d659..f3f9c7d285 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过滤