Registry -> util

This commit is contained in:
Konstantin Bulenkov
2011-03-11 14:19:01 +03:00
parent 19a4188023
commit 227e2129a9
5 changed files with 15 additions and 11 deletions
@@ -330,7 +330,7 @@ public class JavaCompletionContributor extends CompletionContributor {
return false;
}
if (NameUtil.useMinusculeHumpMatcher) return true;
if (NameUtil.isUseMinusculeHumpMatcher()) return true;
final String s = result.getPrefixMatcher().getPrefix();
if (StringUtil.isEmpty(s) || !Character.isUpperCase(s.charAt(0))) return false;
@@ -104,7 +104,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
if (!isPopupActive()) return null;
final SpeedSearchComparator comparator = getComparator();
final String recentSearchText = comparator.getRecentSearchText();
return recentSearchText != null && recentSearchText.length() > 0 && comparator.doCompare(recentSearchText, text) && !NameUtil.useMinusculeHumpMatcher ? comparator.getRecentSearchMatcher() : null;
return recentSearchText != null && recentSearchText.length() > 0 && comparator.doCompare(recentSearchText, text) && !NameUtil.isUseMinusculeHumpMatcher() ? comparator.getRecentSearchMatcher() : null;
}
/**
@@ -183,7 +183,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
if (myRecentSearchText != null &&
myRecentSearchText.equals(pattern)
) {
if (NameUtil.useMinusculeHumpMatcher) {
if (NameUtil.isUseMinusculeHumpMatcher()) {
return myMinusculeMatcher.matches(text);
}
@@ -202,7 +202,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
final Pattern recentSearchPattern = Pattern.compile(buf.toString(), allLowercase ? Pattern.CASE_INSENSITIVE : 0);
myRecentSearchMatcher = recentSearchPattern.matcher(text);
if (NameUtil.useMinusculeHumpMatcher) {
if (NameUtil.isUseMinusculeHumpMatcher()) {
myMinusculeMatcher = new NameUtil.MinusculeMatcher(myShouldMatchFromTheBeginning ? pattern : "*" + pattern);
return myMinusculeMatcher.matches(text);
}
@@ -94,6 +94,7 @@ debugger.mayBringFrameToFrontOnBreakpoint=true
filesystem.useNative=true
analyze.exceptions.on.the.fly=false
analyze.exceptions.on.the.fly.description=Automatically analyze clipboard on frame activation, and if there is a stacktrace calls Analyze Stacktrace
compiler.perform.outputs.refresh.on.start=false
compiler.perform.outputs.refresh.on.start.description=Whether to perform initial FS refresh before compilation starts. Need this to detect external changes to output dirs
@@ -119,3 +120,5 @@ navbar.userActivityMergeTime=500
navbar.newpopup=true
inspectionGadgets.telemetry.enabled=false
minuscule.humps.matching=false
minuscule.humps.matching.description=Camel Case without holding Shift in Ctrl+N/Ctrl+Shift+N etc
@@ -15,6 +15,7 @@
*/
package com.intellij.psi.codeStyle;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
@@ -39,7 +40,6 @@ public class NameUtil {
}
};
private static final int MAX_LENGTH = 40;
public static final boolean useMinusculeHumpMatcher = "true".equals(System.getProperty("minuscule.humps.matching"));
private NameUtil() {}
@@ -390,12 +390,13 @@ public class NameUtil {
return buildMatcher(pattern, buildRegexp(pattern, exactPrefixLen, allowToUpper, allowToLower, lowerCaseWords, false));
}
private static Matcher buildMatcher(final String pattern, String regexp) {
if (useMinusculeHumpMatcher) {
return new MinusculeMatcher(pattern);
}
public static boolean isUseMinusculeHumpMatcher() {
return Registry.is("minuscule.humps.matching");
}
return new OptimizedMatcher(pattern, regexp);
private static Matcher buildMatcher(final String pattern, String regexp) {
return isUseMinusculeHumpMatcher() ? new MinusculeMatcher(pattern)
: new OptimizedMatcher(pattern, regexp);
}
private static class OptimizedMatcher implements Matcher {
@@ -454,7 +454,7 @@ public class GroovyCompletionContributor extends CompletionContributor {
});
final String s = result.getPrefixMatcher().getPrefix();
if (NameUtil.useMinusculeHumpMatcher || !StringUtil.isEmpty(s) && Character.isUpperCase(s.charAt(0))) {
if (NameUtil.isUseMinusculeHumpMatcher() || !StringUtil.isEmpty(s) && Character.isUpperCase(s.charAt(0))) {
addAllClasses(parameters, result, inheritors);
}
}