Lines 44-49
Link Here
|
44 |
import java.util.Comparator; |
44 |
import java.util.Comparator; |
45 |
import javax.swing.text.AttributeSet; |
45 |
import javax.swing.text.AttributeSet; |
46 |
import org.netbeans.api.editor.settings.EditorStyleConstants; |
46 |
import org.netbeans.api.editor.settings.EditorStyleConstants; |
|
|
47 |
import org.openide.util.NbBundle; |
47 |
|
48 |
|
48 |
|
49 |
|
49 |
/** |
50 |
/** |
Lines 51-69
Link Here
|
51 |
* @author Jan Jancura |
52 |
* @author Jan Jancura |
52 |
*/ |
53 |
*/ |
53 |
public final class CategoryComparator implements Comparator<AttributeSet> { |
54 |
public final class CategoryComparator implements Comparator<AttributeSet> { |
54 |
|
55 |
String default_string = NbBundle.getMessage(org.netbeans.modules.editor.NbEditorKit.class, "default"); |
|
|
56 |
|
55 |
public int compare (AttributeSet o1, AttributeSet o2) { |
57 |
public int compare (AttributeSet o1, AttributeSet o2) { |
56 |
String name_1 = name(o1); |
58 |
String name_1 = name(o1); |
57 |
String name_2 = name(o2); |
59 |
String name_2 = name(o2); |
58 |
if (name_1.startsWith ("default")) // NOI18N |
60 |
if (name_1.startsWith (default_string)) |
59 |
return name_2.startsWith ("default") ? 0 : -1; // NOI18N |
61 |
return name_2.startsWith (default_string) ? 0 : -1; |
60 |
if (name_2.startsWith ("default")) // NOI18N |
62 |
if (name_2.startsWith (default_string)) |
61 |
return 1; |
63 |
return 1; |
62 |
return name_1.compareTo (name_2); |
64 |
return name_1.compareTo (name_2); |
63 |
} |
65 |
} |
64 |
|
66 |
|
65 |
private static String name (AttributeSet o) { |
67 |
private static String name (AttributeSet o) { |
66 |
return ((String) o.getAttribute(EditorStyleConstants.DisplayName)).toLowerCase(); |
68 |
return ((String) o.getAttribute(EditorStyleConstants.DisplayName)); |
67 |
} |
69 |
} |
68 |
|
70 |
|
69 |
} |
71 |
} |