RUBY-13071: (refactoring) RegExpPropertyImpl.PROPERTY_NAMES made private

This commit is contained in:
Oleg Sukhodolsky
2013-02-09 15:10:32 +04:00
parent a8058451d5
commit e227a3d793
3 changed files with 12 additions and 6 deletions
@@ -91,7 +91,7 @@ public class RegExpCompletionContributor extends CompletionContributor {
public void addCompletions(@NotNull final CompletionParameters parameters,
final ProcessingContext context,
@NotNull final CompletionResultSet result) {
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
for (String[] stringArray : RegExpPropertyImpl.getAllKnownProperties()) {
result.addElement(
TailTypeDecorator.withTail(createLookupElement(stringArray[0], null, emptyIcon), TailType.createSimpleTailType('}')));
}
@@ -103,7 +103,7 @@ public class RegExpCompletionContributor extends CompletionContributor {
public void addCompletions(@NotNull final CompletionParameters parameters,
final ProcessingContext context,
@NotNull final CompletionResultSet result) {
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
for (String[] stringArray : RegExpPropertyImpl.getAllKnownProperties()) {
addLookupElement(result, "{" + stringArray[0] + "}", stringArray.length > 1 ? stringArray[1]:null, PlatformIcons.PROPERTY_ICON);
}
}
@@ -126,7 +126,7 @@ public class RegExpCompletionContributor extends CompletionContributor {
addLookupElement(result, completions[i], completionsTypes[i], emptyIcon);
}
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
for (String[] stringArray : RegExpPropertyImpl.getAllKnownProperties()) {
addLookupElement(result, "p{" + stringArray[0] + "}", stringArray.length > 1? stringArray[1]:null, PlatformIcons.PROPERTY_ICON);
}
}
@@ -94,6 +94,12 @@ public class RegExpPropertyImpl extends RegExpElementImpl implements RegExpPrope
}
return null;
}
@NotNull
public static String[][] getAllKnownProperties() {
return RegExpPropertyImpl.PROPERTY_NAMES;
}
private class MyPsiReference implements PsiReference {
public PsiElement getElement() {
return RegExpPropertyImpl.this;
@@ -205,7 +211,7 @@ public class RegExpPropertyImpl extends RegExpElementImpl implements RegExpPrope
}
UNICODE_BLOCKS = ArrayUtil.toStringArray(unicodeBlocks);
}
public static final String[][] PROPERTY_NAMES = {
private static final String[][] PROPERTY_NAMES = {
{ "Cn", "UNASSIGNED" },
{ "Lu", "UPPERCASE_LETTER" },
{ "Ll", "LOWERCASE_LETTER" },
@@ -52,7 +52,7 @@ public class RegExpCompletionTest extends CodeInsightFixtureTestCase {
private void doBackSlashVariantsTest() throws Throwable {
java.util.List<String> nameList = new ArrayList<String>(Arrays.asList("d", "D", "s", "S", "w", "W", "b", "B", "A", "G", "Z", "z", "Q", "E",
"t", "n", "r", "f", "a", "e"));
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
for (String[] stringArray : RegExpPropertyImpl.getAllKnownProperties()) {
nameList.add("p{" + stringArray[0] + "}");
}
myFixture.testCompletionVariants(getInputDataFileName(getTestName(true)), ArrayUtil.toStringArray(nameList));
@@ -60,7 +60,7 @@ public class RegExpCompletionTest extends CodeInsightFixtureTestCase {
public void testPropertyVariants() throws Throwable {
java.util.List<String> nameList = new ArrayList<String>();
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
for (String[] stringArray : RegExpPropertyImpl.getAllKnownProperties()) {
nameList.add("{" + stringArray[0] + "}");
}
myFixture.testCompletionVariants(getInputDataFileName(getTestName(true)), ArrayUtil.toStringArray(nameList));