This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Sorting with type for files in folders does not work properly | ||
---|---|---|---|
Product: | platform | Reporter: | darrshan |
Component: | Data Systems | Assignee: | Jaroslav Havlin <jhavlin> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | apireviews, markiewb |
Priority: | P3 | Keywords: | API_REVIEW_FAST |
Version: | 7.2.1 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Proposed Patch |
Description
darrshan
2013-06-06 08:04:51 UTC
I tried to use the sorting option available for flies listed on a node/folder. If I use sort using "type" it does not work correctly. I looked upon the logic in FolderComparator class in org.openide.loaders module. There "compareClass" method is called to sort based on type. Say we have .java files, .properties files and .xml files in folder. Inside the "compareClass" method the "compareNames" method is called which compares file objects names with extensions. Because the name is also considered the files are sorted based on the name rather than on its extension. Hence the incorrect result. I think calling the "compareNames" is incorrect. Rather a new method should be written to compare the extensions and then if the extensions are the same , "NameExt" comparison should be made Thanks for reporting and fine evaluation. Reassigning to Data Systems. Created attachment 140980 [details]
Proposed Patch
(In reply to darrshan from comment #1) > I think calling the "compareNames" is incorrect. Rather a new method should > be written to compare the extensions and then if the extensions are the same > , "NameExt" comparison should be made We cannot change the method for backward compatibility. It was designed to compare the objects by class, so we cannot modify it. But I think its display name should be changed to "By Class". For sorting by file extension, we should introduce new sort mode. Please review the attached patch. New public field: org.openide.loaders.DataFolder.SortMode.EXTENSIONS Thank you. If there are no objections, I'll integrate the patch tomorrow. Thank you for reviewing. |