diff --git a/plugins/devkit/devkit.iml b/plugins/devkit/devkit.iml index a8648ee3a234..5bb1a63c0220 100644 --- a/plugins/devkit/devkit.iml +++ b/plugins/devkit/devkit.iml @@ -38,6 +38,5 @@ - \ No newline at end of file diff --git a/plugins/devkit/resources/META-INF/plugin.xml b/plugins/devkit/resources/META-INF/plugin.xml index d6bde729eb1a..05c92ded3196 100644 --- a/plugins/devkit/resources/META-INF/plugin.xml +++ b/plugins/devkit/resources/META-INF/plugin.xml @@ -11,7 +11,6 @@ JetBrains com.intellij.properties - com.intellij.java-i18n org.jetbrains.idea.devkit.DevKitBundle diff --git a/plugins/devkit/src/dom/impl/LanguageResolvingUtil.java b/plugins/devkit/src/dom/impl/LanguageResolvingUtil.java index 98c122b68800..da767f6a34f2 100644 --- a/plugins/devkit/src/dom/impl/LanguageResolvingUtil.java +++ b/plugins/devkit/src/dom/impl/LanguageResolvingUtil.java @@ -17,19 +17,14 @@ package org.jetbrains.idea.devkit.dom.impl; import com.intellij.codeInsight.completion.CompletionContributorEP; import com.intellij.codeInspection.dataFlow.StringExpressionHelper; -import com.intellij.codeInspection.i18n.JavaI18nUtil; -import com.intellij.codeInspection.i18n.folding.PropertyFoldingBuilder; import com.intellij.icons.AllIcons; import com.intellij.lang.DependentLanguage; import com.intellij.lang.Language; -import com.intellij.lang.properties.IProperty; import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; -import com.intellij.psi.impl.JavaConstantExpressionEvaluator; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.GlobalSearchScopesCore; import com.intellij.psi.search.ProjectScope; @@ -191,28 +186,6 @@ class LanguageResolvingUtil { @Nullable private static String getStringConstantExpression(PsiElement psiElement) { - if (psiElement instanceof PsiMethodCallExpression) { - final PsiExpression[] args = ((PsiMethodCallExpression)psiElement).getArgumentList().getExpressions(); - if (args.length > 0 && args[0] instanceof PsiLiteralExpression && args[0].isValid() - && PropertyFoldingBuilder.isI18nProperty((PsiLiteralExpression)args[0])) { - final int count = JavaI18nUtil.getPropertyValueParamsMaxCount(args[0]); - if (args.length == 1 + count) { - IProperty property = PropertyFoldingBuilder.getI18nProperty((PsiLiteralExpression)args[0]); - String text = property != null ? property.getValue() : null; - if (text == null) { - return null; - } - for (int i = 1; i < count + 1; i++) { - Object value = JavaConstantExpressionEvaluator.computeConstantExpression(args[i], false); - if (value == null) { - return null; - } - text = text.replace("{" + (i - 1) + "}", value.toString()); - } - return text == null || text.equals(psiElement.getText()) ? text : text.replace("''", "'"); - } - } - } final Pair pair = StringExpressionHelper.evaluateConstantExpression(psiElement); return pair != null ? pair.second : null; } diff --git a/plugins/devkit/testData/codeInsight/MyBundle.java b/plugins/devkit/testData/codeInsight/MyBundle.java deleted file mode 100644 index c682ad6b94d7..000000000000 --- a/plugins/devkit/testData/codeInsight/MyBundle.java +++ /dev/null @@ -1,15 +0,0 @@ -import org.jetbrains.annotations.PropertyKey; - -public class MyBundle { - public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) { - return ourInstance.getMessage(key, params); - } - - @NonNls - private static final String BUNDLE = "MyBundle"; - private static final MyBundle ourInstance = new MyBundle(); - - private MyBundle() { - super(BUNDLE); - } -} diff --git a/plugins/devkit/testData/codeInsight/MyBundle.properties b/plugins/devkit/testData/codeInsight/MyBundle.properties deleted file mode 100644 index 59b44ecb17aa..000000000000 --- a/plugins/devkit/testData/codeInsight/MyBundle.properties +++ /dev/null @@ -1 +0,0 @@ -language.name=MyAnonymousLanguageWithNameFromBundleID \ No newline at end of file diff --git a/plugins/devkit/testData/codeInsight/MyLanguage.java b/plugins/devkit/testData/codeInsight/MyLanguage.java index 22a63571d443..bb7034a3347d 100644 --- a/plugins/devkit/testData/codeInsight/MyLanguage.java +++ b/plugins/devkit/testData/codeInsight/MyLanguage.java @@ -1,8 +1,6 @@ public class MyLanguage extends com.intellij.lang.Language { public static final com.intellij.lang.Language ANONYMOUS_LANUAGE = new MySubLanguage("MyAnonymousLanguageID", "MyDisplayName") { }; - public static final MyLanguage ANONYMOUS_LANUAGE_WITH_NAME_FROM_PROPERTIES = new MyLanguage(MyBundle.message("language.name")) { - }; public MyLanguage() { super("MyLanguageID"); diff --git a/plugins/devkit/testData/codeInsight/languageAttribute.xml b/plugins/devkit/testData/codeInsight/languageAttribute.xml index 4112526e22ab..1aec4b75c4fb 100644 --- a/plugins/devkit/testData/codeInsight/languageAttribute.xml +++ b/plugins/devkit/testData/codeInsight/languageAttribute.xml @@ -4,14 +4,11 @@ - - MyBundle - INVALID_VALUE"/> diff --git a/plugins/devkit/testSources/codeInsight/PluginXmlFunctionalTest.groovy b/plugins/devkit/testSources/codeInsight/PluginXmlFunctionalTest.groovy index 8adb4847724c..1bdfe4d6ecfd 100644 --- a/plugins/devkit/testSources/codeInsight/PluginXmlFunctionalTest.groovy +++ b/plugins/devkit/testSources/codeInsight/PluginXmlFunctionalTest.groovy @@ -257,8 +257,7 @@ public class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase { def lookupElements = myFixture.complete(CompletionType.BASIC).sort { it.lookupString } assertLookupElement(lookupElements[0], "MyAnonymousLanguageID", "MyLanguage.MySubLanguage") - assertLookupElement(lookupElements[1], "MyAnonymousLanguageWithNameFromBundleID", "MyLanguage") - assertLookupElement(lookupElements[2], "MyLanguageID", "MyLanguage") + assertLookupElement(lookupElements[1], "MyLanguageID", "MyLanguage") } private static void assertLookupElement(LookupElement element, String lookupString, String typeText) { @@ -273,22 +272,7 @@ public class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase { "public class Language { " + " protected Language(String id) {}" + "}") - myFixture.addClass("package org.jetbrains.annotations;\n" + - "import java.lang.annotation.Documented;\n" + - "import java.lang.annotation.ElementType;\n" + - "import java.lang.annotation.Retention;\n" + - "import java.lang.annotation.RetentionPolicy;\n" + - "import java.lang.annotation.Target;\n" + - "\n" + - "@Documented\n" + - "@Retention(RetentionPolicy.CLASS)\n" + - "@Target({ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.FIELD})\n" + - "public @interface PropertyKey {\n" + - " String resourceBundle();\n" + - "}") myFixture.allowTreeAccessForFile(myFixture.copyFileToProject("MyLanguage.java")) - myFixture.allowTreeAccessForFile(myFixture.copyFileToProject("MyBundle.java")) - myFixture.allowTreeAccessForFile(myFixture.copyFileToProject("MyBundle.properties")) } public void testIconAttribute() {