You need to log in before you can comment on or make changes to this bug.
"All Languages" and "Default" should be listed at the top of list and should be selected when Font and Color is selected on Option dialog. However, when these strings are localized, sort is not working properly, so other item is selected by default. It's hard to find such defaults items. 1. Tools > Options 2. select Fonts & Colors tag On Syntax tab, top of Language dropdown list should be "All Languages" and it should be selected. but it's not when we localize it. 3. Select "All Languages" "Default" should be listed on the top and selected by default on Category list, but it's not when it's localized. (It seems that bug 71987 has not been fixed completely) For "All Languages" issue, it seems that compare() of LanguagesComparator is not correct. I think we need to add the case when o2 == ColorModel.ALL_LANGUAGES. --- editor/options/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java (1.48) +++ editor/options/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java (1.48 ) @@ -997,6 +997,8 @@ public int compare(String o1, String o2) { if (o1.equals(ColorModel.ALL_LANGUAGES)) return o2.equals(ColorModel.ALL_LANGUAGES) ? 0 : -1; + if (o2.equals(ColorModel.ALL_LANGUAGES)) + return 1; return o1.compareTo(o2); } } For "Default" issue, in the following codes of editor/options/src/org/netbeans/modules/options/colors/CategoryComparator.java, it seems that name() is returning localized string. It should compare with localized "Default", not english "default". public int compare (AttributeSet o1, AttributeSet o2) { String name_1 = name(o1); String name_2 = name(o2); if (name_1.startsWith ("default")) // NOI18N return name_2.startsWith ("default") ? 0 : -1; // NOI18N if (name_2.startsWith ("default")) // NOI18N return 1; return name_1.compareTo (name_2); } private static String name (AttributeSet o) { return ((String) o.getAttribute(EditorStyleConstants.DisplayName)).toLowerCase(); }
Hi Masaki, thanks for catching this and for your analysis. You've become quite familiar with the internals of Tools-Options, haven't you? That's great! If you would like commit rights to the editor modules for fixing these little niches, I can give you the developer role. Otherwise, I'm happy to keep applying your patches, no problem with that.
Thank you very much. I want to try by myself. I'll let you know when the patch is ready and ask for review.
Cool! Thanks for helping out.
Created an attachment (id=54309) [details] proposed patch, please review
The patch looks ok to me. Please go ahead and apply it. Thanks
Thank you!! I have put them into trunk. Checking in CategoryComparator.java; /cvs/editor/options/src/org/netbeans/modules/options/colors/CategoryComparator.java,v <-- CategoryComparator.java new revision: 1.10; previous revision: 1.9 Checking in SyntaxColoringPanel.java; /cvs/editor/options/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java,v <-- SyntaxColoringPanel.java new revision: 1.49; previous revision: 1.48