Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
81f9374a
Commit
81f9374a
authored
6 years ago
by
Nicolay Mitropolsky
Browse files
Options
Download
Email Patches
Plain Diff
`UastStringLiteralReferenceProvider` as a replacement for `UastLiteralReferenceProvider`
parent
837acd61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java
+1
-1
...8n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java
plugins/java-i18n/src/com/intellij/lang/properties/UastPropertiesReferenceProvider.java
+2
-2
...llij/lang/properties/UastPropertiesReferenceProvider.java
uast/uast-common/src/com/intellij/psi/UastInjectionHostReferenceProvider.kt
+23
-0
...rc/com/intellij/psi/UastInjectionHostReferenceProvider.kt
with
26 additions
and
3 deletions
+26
-3
plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java
+
1
-
1
View file @
81f9374a
...
...
@@ -60,7 +60,7 @@ public class JavaI18nUtil extends I18nUtil {
return
isPassedToAnnotatedParam
(
expression
,
AnnotationUtil
.
PROPERTY_KEY
,
resourceBundleRef
,
null
);
}
public
static
boolean
mustBePropertyKey
(
@NotNull
U
Literal
Expression
expression
,
@Nullable
Ref
<?
super
UExpression
>
resourceBundleRef
)
{
public
static
boolean
mustBePropertyKey
(
@NotNull
UExpression
expression
,
@Nullable
Ref
<?
super
UExpression
>
resourceBundleRef
)
{
final
UElement
parent
=
expression
.
getUastParent
();
if
(
parent
instanceof
UVariable
)
{
UAnnotation
annotation
=
((
UVariable
)
parent
).
findAnnotation
(
AnnotationUtil
.
PROPERTY_KEY
);
...
...
This diff is collapsed.
Click to expand it.
plugins/java-i18n/src/com/intellij/lang/properties/UastPropertiesReferenceProvider.java
+
2
-
2
View file @
81f9374a
...
...
@@ -7,7 +7,7 @@ import com.intellij.openapi.util.Ref;
import
com.intellij.psi.PsiElement
;
import
com.intellij.psi.PsiLanguageInjectionHost
;
import
com.intellij.psi.PsiReference
;
import
com.intellij.psi.UastLiteralReferenceProvider
;
import
com.intellij.psi.Uast
String
LiteralReferenceProvider
;
import
com.intellij.util.ProcessingContext
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.uast.*
;
...
...
@@ -15,7 +15,7 @@ import org.jetbrains.uast.*;
/**
* @author cdr
*/
class
UastPropertiesReferenceProvider
extends
UastLiteralReferenceProvider
{
class
UastPropertiesReferenceProvider
extends
Uast
String
LiteralReferenceProvider
{
private
final
boolean
myDefaultSoft
;
...
...
This diff is collapsed.
Click to expand it.
uast/uast-common/src/com/intellij/psi/UastInjectionHostReferenceProvider.kt
+
23
-
0
View file @
81f9374a
...
...
@@ -39,4 +39,27 @@ abstract class UastLiteralReferenceProvider : UastReferenceProvider() {
host
:
PsiLanguageInjectionHost
,
context
:
ProcessingContext
):
Array
<
PsiReference
>
}
abstract
class
UastStringLiteralReferenceProvider
:
UastReferenceProvider
()
{
override
val
supportedUElementTypes
:
List
<
Class
<
out
UElement
>>
=
listOf
(
UExpression
::
class
.
java
)
override
fun
getReferencesByElement
(
element
:
UElement
,
context
:
ProcessingContext
):
Array
<
PsiReference
>
{
val
injectionHost
=
context
[
REQUESTED_PSI_ELEMENT
]
as
?
PsiLanguageInjectionHost
?:
return
PsiReference
.
EMPTY_ARRAY
if
(
element
is
ULiteralExpression
)
return
getReferencesByULiteral
(
element
,
injectionHost
,
context
)
// simple string (java usually)
if
(
element
is
UPolyadicExpression
)
{
// Kotlin, see KT-27283
return
element
.
operands
.
asSequence
().
filterIsInstance
<
ULiteralExpression
>().
flatMap
{
getReferencesByULiteral
(
it
,
injectionHost
,
context
).
asSequence
()
}.
toList
().
toTypedArray
()
}
return
PsiReference
.
EMPTY_ARRAY
}
abstract
fun
getReferencesByULiteral
(
uLiteral
:
ULiteralExpression
,
host
:
PsiLanguageInjectionHost
,
context
:
ProcessingContext
):
Array
<
PsiReference
>
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help