Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 123853 - I18N: "All Languages" and "Default" is not selected by default when these strings are localized
I18N: "All Languages" and "Default" is not selected by default when these str...
Product: editor
Classification: Unclassified
Component: Options
All All
: P2 (vote)
: 6.x
Assigned To: Masaki Katakai
Depends on:
  Show dependency treegraph
Reported: 2007-12-11 23:03 UTC by Masaki Katakai
Modified: 2007-12-19 17:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

proposed patch, please review (2.55 KB, patch)
2007-12-17 01:37 UTC, Masaki Katakai
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Katakai 2007-12-11 23:03:40 UTC
"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/  (1.48)
+++ editor/options/src/org/netbeans/modules/options/colors/  (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
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();
Comment 1 Vitezslav Stejskal 2007-12-12 09:48:17 UTC
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.
Comment 2 Masaki Katakai 2007-12-13 09:39:55 UTC
Thank you very much. I want to try by myself. I'll let you know when the patch is ready and ask for review.
Comment 3 Vitezslav Stejskal 2007-12-13 10:18:00 UTC
Cool! Thanks for helping out.
Comment 4 Masaki Katakai 2007-12-17 01:37:13 UTC
Created attachment 54309 [details]
proposed patch, please review
Comment 5 Vitezslav Stejskal 2007-12-19 10:32:36 UTC
The patch looks ok to me. Please go ahead and apply it. Thanks
Comment 6 Masaki Katakai 2007-12-19 17:27:09 UTC
Thank you!! I have put them into trunk.

Checking in;
/cvs/editor/options/src/org/netbeans/modules/options/colors/,v  <--
new revision: 1.10; previous revision: 1.9

Checking in;
/cvs/editor/options/src/org/netbeans/modules/options/colors/,v  <--
new revision: 1.49; previous revision: 1.48

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo