resource bundle editor: use case insensitive comparator to compare property keys in all places (IDEA-148792)

This commit is contained in:
Dmitry Batkovich
2015-12-09 15:21:03 +03:00
parent bb37b431c2
commit fb9ee4c8da
3 changed files with 6 additions and 6 deletions
@@ -183,7 +183,7 @@ public class PropertiesImplUtil extends PropertiesUtil {
if (key == null) {
return false;
}
if (previousKey != null && previousKey.compareTo(key) > 0) {
if (previousKey != null && String.CASE_INSENSITIVE_ORDER.compare(previousKey, key) > 0) {
return false;
}
previousKey = key;
@@ -166,7 +166,7 @@ public class PropertiesFileImpl extends PsiFileBase implements PropertiesFile {
final String k1 = p1.getKey();
final String k2 = p2.getKey();
LOG.assertTrue(k1 != null && k2 != null);
return k1.compareTo(k2);
return String.CASE_INSENSITIVE_ORDER.compare(k1, k2);
}
});
return insertIndex == -1 ? null :myProperties.get(insertIndex < 0 ? - insertIndex - 2 : insertIndex);
@@ -139,7 +139,7 @@ public class ResourceBundlePropertiesUpdateManager {
@Nullable
private static Pair<List<String>, Boolean> keysOrder(final ResourceBundle resourceBundle) {
final boolean[] isEdgesProperlyDirection = new boolean[]{true};
final boolean[] isAlphaSorted = new boolean[]{true};
final GraphGenerator<String> generator = GraphGenerator.create(CachingSemiGraph.create(new GraphGenerator.SemiGraph<String>() {
@Override
public Collection<String> getNodes() {
@@ -167,8 +167,8 @@ public class ResourceBundlePropertiesUpdateManager {
if (sibling instanceof IProperty) {
final String key = ((IProperty)sibling).getKey();
if (key != null) {
if (isEdgesProperlyDirection[0] && n.compareTo(key) > 0) {
isEdgesProperlyDirection[0] = false;
if (isAlphaSorted[0] && String.CASE_INSENSITIVE_ORDER.compare(n, key) > 0) {
isAlphaSorted[0] = false;
}
siblings.add(key);
}
@@ -181,7 +181,7 @@ public class ResourceBundlePropertiesUpdateManager {
DFSTBuilder<String> dfstBuilder = new DFSTBuilder<String>(generator);
final boolean acyclic = dfstBuilder.isAcyclic();
if (acyclic) {
if (isEdgesProperlyDirection[0]) {
if (isAlphaSorted[0]) {
final List<String> sortedNodes = new ArrayList<String>(generator.getNodes());
Collections.sort(sortedNodes, String.CASE_INSENSITIVE_ORDER);
return Pair.create(sortedNodes, true);