Browse Source

无JIRA任务 修改严重findbugs

final/10.0
ju 6 years ago
parent
commit
6675c853b8
  1. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  2. 10
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java

11
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java

@ -1,6 +1,6 @@
package com.fr.design.gui.itree.filetree; 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 com.fr.file.filetree.FileNode;
import java.util.Comparator; import java.util.Comparator;
@ -59,13 +59,14 @@ public class FileNodeComparator implements Comparator<FileNode> {
private int groupByFileType(FileNode nameNode1, FileNode nameNode2, private int groupByFileType(FileNode nameNode1, FileNode nameNode2,
int i) { int i) {
if (i < LocalFileNodes.FILE_TYPE.length) { String[] supportTypes = FRContext.getFileNodes().getSupportedTypes();
if (nameNode1.isFileType(LocalFileNodes.FILE_TYPE[i])) if (i < supportTypes.length) {
if (nameNode2.isFileType(LocalFileNodes.FILE_TYPE[i])) if (nameNode1.isFileType(supportTypes[i]))
if (nameNode2.isFileType(supportTypes[i]))
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
else else
return-1; return-1;
else if (nameNode2.isFileType(LocalFileNodes.FILE_TYPE[i])) else if (nameNode2.isFileType(supportTypes[i]))
return 1; return 1;
else{ else{
return groupByFileType(nameNode1, nameNode2, i+1); return groupByFileType(nameNode1, nameNode2, i+1);

10
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.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.file.filter.FILEFilter; import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -693,14 +692,9 @@ public class FILEChooserPane extends BasicPane {
String appName = ProductConstants.APP_NAME; String appName = ProductConstants.APP_NAME;
JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate editing = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editing == null || !editing.isChartBook()) { if (editing == null || !editing.isChartBook()) {
String[] fileSuffix_local = LocalFileNodes.FILE_TYPE;
EnumSet<FileExtension> fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT);
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
if (WorkContext.getCurrent().isLocal()) { //本地连接 this.addChooseFILEFilter(new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
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")));
}
} }
// ben:filefilter设置初值为cpt过滤 // ben:filefilter设置初值为cpt过滤

Loading…
Cancel
Save